#include <sys/types.h> /* stat */
#include <sys/stat.h> /* stat */
-#include <sys/wait.h> /* wait() */
+#ifndef WIN32
+ #include <sys/wait.h> /* wait() */
+#else
+ #include <process.h>
+ #define waitpid(pid, status, options) _cwait(status, pid, WAIT_CHILD)
+#endif
#include <unistd.h> /* stat */
#include <dirent.h>
static void
onSigCHLD( int i UNUSED )
{
- waitpid( -1, 0, WNOHANG );
+ waitpid( -1, NULL, WNOHANG );
}
static void
NULL };
tr_torinf( tor, "Calling script \"%s\"", script );
+
+#ifdef WIN32
+ _spawnvpe( _P_NOWAIT, script, (const char*)cmd, env );
+#else
signal( SIGCHLD, onSigCHLD );
if( !fork( ) )
execve( script, cmd, env );
_exit( 0 );
}
+#endif
for( i=0; cmd[i]; ++i ) tr_free( cmd[i] );
for( i=0; env[i]; ++i ) tr_free( env[i] );