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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux