sub win32_system { my (@command) = @_; my ($pid, $child_process, $exitcode); # this magic syntax makes system() async and return the # pid of the created process, see "perldoc perlport" $pid = system( 1, @command ); # Get the Win32 native handle to the process we just created Win32::Process::Open( $child_process, $pid, 0 ) || die; # Win32::Process equivalent of waitpid() $child_process->Wait( INFINITE ); $child_process->GetExitCode( $exitcode ); # Returns the real 32-bit exit code, no overflow return $exitcode; }