in reply to IPC::Open2, WinXP, Perl 5.6.1
Some RTFM is in order on your part (`perldoc IPC::Open2').use strict; use IPC::Open2; use Carp; eval { open2(*RDRFH, *WTRFH, 'xxx'); }; if ($@) { if ($@ =~ /^open2/) { warn "open2 failed: $!\n$@\n"; return; } die; # reraise unforeseen exception } warn "HELLO BUDDY"; __END__ 'xxx' is not recognized as an internal or external command, operable program or batch file. HELLO BUDDY at - line 13.
update: whoooops. I see why you thought that. But still, you should be checking the pid. open2() returns the process ID of the child process. It doesn't return on failure: it just raises an exception matching /^open2:/. However, exec failures in the child are not detected. You'll have to trap SIGPIPE yourself.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: IPC::Open2, WinXP, Perl 5.6.1
by mrd (Beadle) on Feb 11, 2004 at 12:53 UTC | |
by PodMaster (Abbot) on Feb 11, 2004 at 13:05 UTC | |
by mrd (Beadle) on Feb 11, 2004 at 14:34 UTC | |
by PodMaster (Abbot) on Feb 11, 2004 at 18:10 UTC | |
by mrd (Beadle) on Feb 12, 2004 at 09:51 UTC |