when running external programs (such as unrar or post-processing script) the full path to the program is not neccessary since the search in system PATH is now performed

This commit is contained in:
Andrey Prygunkov
2013-02-09 10:58:14 +00:00
parent ac29412b2f
commit 30d792b35b

View File

@@ -50,6 +50,9 @@
#include "Log.h"
#include "Util.h"
// System global variable holding environments variables
extern char** environ;
extern Options* g_pOptions;
extern char* (*g_szEnvironmentVariables)[];
extern DownloadQueueHolder* g_pDownloadQueueHolder;
@@ -369,8 +372,9 @@ int ScriptController::Execute()
#endif
chdir(m_szWorkingDir);
execve(m_szScript, (char* const*)m_szArgs, (char* const*)pEnvironmentStrings);
fprintf(stdout, "[ERROR] Could not start script: %s", strerror(errno));
environ = pEnvironmentStrings;
execvp(m_szScript, (char* const*)m_szArgs);
fprintf(stdout, "[ERROR] Could not start %s: %s", m_szScript, strerror(errno));
fflush(stdout);
_exit(-1);
}