Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Effect of redirecting output to /dev/null on $? value

by Special_K (Monk)
on Aug 03, 2020 at 06:35 UTC ( [id://11120251]=note: print w/replies, xml ) Need Help??


in reply to Re: Effect of redirecting output to /dev/null on $? value
in thread Effect of redirecting output to /dev/null on $? value

Thanks for the explanation. I ran a different, more complex application with a deliberate seg fault added again using my method above and now see the following as the output:

sh: line 1: 26902 Segmentation fault my_complex_executable_that_s +egfaults > /dev/null return value is 35584 exit_value = 139 signal_num = 0 dumped_core = 0
In the above case, 0x80 | signal_num = 0x80 | 0x0B = 0x8B = 139, which matches the listed exit_value. 35584 is just the exit value shifted up 8 bits, which is consistent with the definition of $?.

What does the 26902 value indicate? Is that the 16-bit status int set by wait(2) from running my_complex_executable_that_segfaults that can be parsed by perl to assemble the fields of the $? variable, and can also be accessed directly in C/C++ using the macros WTERMSIG, WEXITSTATUS, etc. (source: https://linux.die.net/man/2/wait)?

Replies are listed 'Best First'.
Re^3: Effect of redirecting output to /dev/null on $? value
by jcb (Parson) on Aug 04, 2020 at 01:17 UTC
    What does the 26902 value indicate?

    The shell generated that message to report that a subprocess with PID 26902 exited with a segmentation fault. The hint is that it starts with "sh: line 1:". The shell sees your command as a one-line shell script.

Re^3: Effect of redirecting output to /dev/null on $? value
by ikegami (Patriarch) on Aug 03, 2020 at 16:50 UTC

    What does the 26902 value indicate?

    pid? I don't think I've ever seen a message like that.

    It's not a exit status. 26902 = 0x6916. As a status, this would mean the process exited with code 0x69 and it was killed by signal 0x16, but those are mutually exclusive.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11120251]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-29 13:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found