Skip to content
Commit 2b57229f authored by Mike Fleetwood's avatar Mike Fleetwood Committed by Curtis Gedak
Browse files

Implement shell style exit status decoding (#754684)

Command exit status is a 1 byte value between 0 and 255. [1][2]  However
at the Unix API level the value is encoded as documented in the
waitpid(2) manual page.  This is true for the Glib API too. [3]  This is
why, for example, the comment in ext2::check_repair() reported receiving
undocumented exit status 256.  It was actually receiving exit status 1
encoded as per the waitpid(2) method.

Add shell style exit status decoding [2] to execution of all external
commands.   Return value from Utils::execute_command() and
FileSystem::execute_command() functions are now:
    0 - 125 - Exit status from the command
    126     - Error executing the command
    127     - Command not found
    128+N   - Command terminated by signal N
    255     - Unexpected waitpid(2) condition
Also adjust checking of the returned statuses as necessary.

[1] Advanced Bash-Scripting Guide: Appendix D. Exit Codes With Special
    Meanings
    http://www.linuxtopia.org/online_books/...
parent a202b456
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment