Re: Capturing verbose exit codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03Apr2010 18:06, Suvayu Ali <fatkasuvayu+linux@xxxxxxxxx> wrote:
| On Saturday 03 April 2010 04:22 PM, Cameron Simpson wrote:
| > So the shell can report Terminated and Segmentation Fault reliably and
| > Done versus failed because the wait status has distinct information.
| > So he should be able to check done versus failed ($? == 0 versus
| > nonzero), and he may find the shell returns negative values for
| > "terminated by signal N". Core dumps may not be exposed by the shell.
| >
| > Suvayu: try this:
| >
| >    sleep 3600&
| >    kill -9 $!; wait; echo "\$?=$?"
| >
| > and repeat with various kill numbers. See if you get anything useful.
| >
| 
| Thank you Cameron for the hints! With some more thinking and some help 
| from my roomie, I found something useful to work with. Substituting `n' 
| below gives me quite a bit to experiment with. :)
| 
| $ sleep 3600 &
| $ pid=$! ;kill -n $pid;wait $pid;echo "$pid exited with $?"

You should also read "man 2 wait" and likewise for wait3, wait4 and
waitpid (possibly "man 3 blah" for some of these, and they may all show
up on the same manpage). That will give you an idea of what information
the shell gets to know after a process exits.

And to get an idea of what you may expect on UNIX systems in general as
opposed to linux in particular, use "3p" instead of "2" and "3" above;
that will get you the corresponding POSIX manual on most linux systems.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Besides, it's good to force C programmers to use the toolbox occasionally. :-)
        - Larry Wall in <1991May31.181659.28817@xxxxxxxxxxxxxxxxxxxxxxx>
-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux