hm. I assumed it did an implied close once the command was done executing. once i do an explicit close, $? gets the exit value.

thanks everyone who answered this thread.
Greg

-----Original message-----
From: Gyepi SAM <[email protected]>
To: Greg London <[email protected]>
Cc: [email protected]
Sent: Thu, Jul 21, 2011 19:41:42 GMT+00:00
Subject: Re: [Boston.pm] backticks tee'd to stdout ?

On Thu, Jul 21, 2011 at 01:44:48PM -0500, Greg London wrote:
If I open a pipe on a command that has a nonzero exit status,
where do I check that???


close($HANDLE2);

after the read loop in order to get its correct exit status.
If you really want to be thorough, do

my $r = close($HANDLE2);

and look at $r to determine whether you even need to look at $?, etc.

man perlfunc#open for details and other useful bits.

-Gyepi


_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to