(libT) #4633 'if executing the torrent-done script fails, log an error' -- done.

This commit is contained in:
Jordan Lee 2013-01-04 01:48:35 +00:00
parent 707a131b4f
commit cd0628fc8f
1 changed files with 6 additions and 2 deletions

View File

@ -1988,7 +1988,8 @@ torrentCallScript (const tr_torrent * tor, const char * script)
tr_torinf (tor, "Calling script \"%s\"", script);
#ifdef WIN32
_spawnvpe (_P_NOWAIT, script, (const char*)cmd, env);
if (spawnvpe (_P_NOWAIT, script, (const char*)cmd, env) == -1)
tr_torerr (tor, "error executing script \"%s\": %s", cmd[0], tr_strerror (errno));
#else
signal (SIGCHLD, onSigCHLD);
@ -1996,7 +1997,10 @@ torrentCallScript (const tr_torrent * tor, const char * script)
{
for (i=0; env[i]; ++i)
putenv (env[i]);
execvp (script, cmd);
if (execvp (script, cmd) == -1)
tr_torerr (tor, "error executing script \"%s\": %s", cmd[0], tr_strerror (errno));
_exit (0);
}
#endif