[Chicago-talk] testing exit status of external program

Steven Lembark lembark at wrkhors.com
Tue Dec 9 13:19:15 CST 2003

-- Jeremy Hubble <jhubble at core.com>

> Sometimes the result may need a little TLC.  I have worked with some
> apps (particularly Interwon's) where the result would have to be
> shifted 8 bits to get the 'real' return code.  [I am not sure if this
> was due to something the app was doing, or if it was a perl issue.)
> Also, certain older versions of perl (in particular on AIX) did not
> have the return code available via $? when the perl process was spawned
> from another process.

The exit code and signal are always in separate bytes of
$? on *NIX systems. In most cases you want to check for
non-zero exit (program detected a problem and exited
appropriately) vs. zapped by a signal (program may not
have cleaned up after itself).

Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508

More information about the Chicago-talk mailing list