First, Windows can't fork processes. It spawns new processes.
The problem is that your error checking is buggy. You're reporting an error when none occurred.
system($file1); if ($? == -1) { die("Can't execute command: $!\n"); } elsif ($? & 127) { die("Command died from signal ", ($? & 127), "\n"); } elsif ($? >> 8) { die("Command exited with error ", ($? >> 8), "\n"); }
Update: While it's true that your error handling is buggy, it's not the cause of your problem. Could you please add the following lines after system (in either in your version or mine) and post the output.
use Devel::Peek; Dump($?);
I have a hard time believeing $? has a non-integer value or an integer value less than -1, but that's the only way you could get the results you report. This command will report quite precisely the value of $?.
In reply to Re: How to get output from a forked cmd prompt?
by ikegami
in thread How to get output from a spawned cmd prompt?
by Xhings
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |