in reply to How to get output from a spawned cmd prompt?
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 $?.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to get output from a forked cmd prompt?
by Xhings (Acolyte) on Jan 21, 2010 at 09:18 UTC | |
by ikegami (Patriarch) on Jan 21, 2010 at 20:16 UTC |