diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index caf64fb49..88de2c4b1 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -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