Re: Capturing an external program return code

2007-05-01 Thread Mumia W.
On 05/01/2007 07:09 PM, Vladimir Lemberg wrote: [...] system ( "$program -f $program.cfg" ); if ($? == -3) { [...] You're facing two problems: the return value for system() needs to be shifted right by eight bits; and that value is provided in "unsigned" form, so you have to massage it: m

Re: Capturing an external program return code

2007-05-01 Thread Vladimir Lemberg
Hi Tom, That was very helpful. Thanks a lot, Vladimir - Original Message - From: "Tom Phoenix" <[EMAIL PROTECTED]> To: "Vladimir Lemberg" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, May 01, 2007 5:36 PM Subject: Re: Capturing an external program return cod

Re: Capturing an external program return code

2007-05-01 Thread Tom Phoenix
On 5/1/07, Vladimir Lemberg <[EMAIL PROTECTED]> wrote: My script is executing external program, which returns code i.e 0, -1, -2, -3 etc if ($? == -3) { This is not working. Nothing is printing to the log file when I'm simulating -3 code. If I print $?, it shown 65280. The value in $? i

Re: Capturing an external program return code

2007-05-01 Thread Chas Owens
On 5/1/07, Vladimir Lemberg <[EMAIL PROTECTED]> wrote: snip This is not working. Nothing is printing to the log file when I'm simulating -3 code. If I print $?, it shown 65280. snip from perldoc -f system: if ($? == -1) { print "failed to execute: $!\n"; } elsif ($? & 127) {