Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Inappropriate ioctl for device error on system call

by neilwatson (Priest)
on Dec 12, 2006 at 20:58 UTC ( #589412=note: print w/replies, xml ) Need Help??

in reply to Inappropriate ioctl for device error on system call

Problem solved. Enscript's return status is more than simply zero or not zero:
RETURN VALUE Enscript returns value 1 to the shell if any errors were encountered. On successfull termination, the return code is constucted from the following flags: 0 no errors or warnings 2 some lines were truncated or wrapped 4 some characters were missing from the used fonts 8 some characters were unprintable
Would something like
system("/bin/somecommand") < 9 or die "Somecommand failed $!, $?";

Neil Watson

Replies are listed 'Best First'.
Re^2: Inappropriate ioctl for device error on system call
by sgifford (Prior) on Dec 20, 2006 at 06:41 UTC
    The basic idea is right, but $! won't be set by the command exiting with a nonzero exit status (t will be left at whatever the last error happened to be), and $? is the actual exit value times 256, for a normal exit. See system and $! variable for more details.

    Here's an example to try out to see what I mean:

    perl -e 'unlink("nosuchfile"); system("sh","-c","exit 1") == 0 or die "Err: $!,$?"' Err: No such file or directory,256 at -e line 1.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://589412]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2017-01-19 01:32 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (166 votes). Check out past polls.