Question about pipes and exit codes
William Atkinson
CWA at DISC.com
Wed Nov 17 10:24:04 CST 1999
Jason,
Thanks for the suggestion and response.
I originally tried open2 (haven't done open3 yet) but only see sigpipe when
the program at the "far" end of the pipe dies, regardless of the cause of
death. I started on chapter 16 of the cookbook this morning and am at p.
562, so I'd say we are definitely in the same ballpark. I'd also say I'm in
a bit deep too.
The next thing that I'm going to try is fussing with pipe and fork to get a
sort of pipe loop. If I can do that successfully, I can catch the signal
that the child died from.
Chip
> -----Original Message-----
> From: Jason Van Slyke [mailto:jvanslyk at matchlogic.com]
> Sent: Wednesday, November 17, 1999 9:13 AM
> To: 'boulder-pm-list at happyfunball.pm.org'
> Subject: RE: Question about pipes and exit codes
>
>
> Chip,
>
> First up, you're way over my head. But I found this
> interesting so I dug
> out a couple, 3 or 4 books.
>
> Do you have a Perl Cookbook available? If so, see p567-571.
>
> If not, this _might_ help:
>
> eval {
> open2($readme, $writeme, @program_and_arguments) ;
> } ;
> if ($@) {
> if ($@ =~ /^open2/) {
> warn "open2 failed: $!\n$@\n" ;
> return ;
> }
> die ; #reraise unforeseen exception
> }
>
> Let me know if this is playing in the same ball park as you are.
>
> Jason
>
> -----Original Message-----
> From: William Atkinson [mailto:CWA at DISC.com]
> Sent: Wednesday, November 17, 1999 8:46 AM
> To: 'boulder-pm-list at pm.org'
> Subject: Question about pipes and exit codes
>
>
> Greetings,
>
> Forgive and politely correct me if this is the wrong list to post to.
>
> I'm having trouble getting the exit status of a process at
> the end of a pipe
> created by open2. It seems that all I get is notification
> that the pipe
> broke.
>
> One idea that we came up with was to have a shell script run
> the desired
> program, catch its exit status and return it as the last string. The
> problem with this is that I was hoping for a purely perl
> based solution due
> to cross platform portability issues.
>
> Any help would be appreciated.
>
> Thanks.
>
> Chip Atkinson
> chip at disc.com
>
More information about the Boulder-pm
mailing list