if (status < 0) {
if (ckWARN(WARN_EXEC))
Perl_warner(aTHX_ packWARN(WARN_EXEC), "Can't spawn \"%s\": %s",
argv[0], strerror(errno));
status = 255 * 256;
}
else
status *= 256;
PL_statusvalue = status;
####
Can't spawn "some command": No error
####
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;
}
####
sub win32_exit
{
my ($exitcode) = @_;
my $this_process;
# get Win32 native handle to the current process
Win32::Process::Open( $this_process, $$, 0 ) || die;
# "kill" on Windows simply means
# "force the process to exit with that exitcode"
$this_process->Kill( $exitcode );
# we killed ourselves, should never get here
die "Thou shalt never see this!";
}