Changeset 11786


Ignore:
Timestamp:
Jan 30, 2011, 1:41:48 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) #3961 "Support for running scripts when a torrent finishes downloading on Windows" -- fixed. patch by rb07

The changes to torrentCallScript() weren't portable to Windows, so rb07 has provided a patch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r11764 r11786  
    1313#include <sys/types.h> /* stat */
    1414#include <sys/stat.h> /* stat */
    15 #include <sys/wait.h> /* wait() */
     15#ifndef WIN32
     16 #include <sys/wait.h> /* wait() */
     17#else
     18 #include <process.h>
     19 #define waitpid(pid, status, options)  _cwait(status, pid, WAIT_CHILD)
     20#endif
    1621#include <unistd.h> /* stat */
    1722#include <dirent.h>
     
    19421947onSigCHLD( int i UNUSED )
    19431948{
    1944     waitpid( -1, 0, WNOHANG );
     1949    waitpid( -1, NULL, WNOHANG );
    19451950}
    19461951
     
    19701975
    19711976        tr_torinf( tor, "Calling script \"%s\"", script );
     1977
     1978#ifdef WIN32
     1979        _spawnvpe( _P_NOWAIT, script, (const char*)cmd, env );
     1980#else
    19721981        signal( SIGCHLD, onSigCHLD );
    19731982
     
    19771986            _exit( 0 );
    19781987        }
     1988#endif
    19791989
    19801990        for( i=0; cmd[i]; ++i ) tr_free( cmd[i] );
Note: See TracChangeset for help on using the changeset viewer.