mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-02 09:01:25 +00:00
Avoid confusion between exit code and signal values
This commit is contained in:
1 parent
5564407a97
commit
7e23087b89
1 file changed
+6
-1
@@ -209,7 +209,12 @@ fn extract_exit_code(status: ExitStatus) -> Option<i32> {
|
|||||||
"On Unix, this will return None if the process was terminated by a signal."
|
"On Unix, this will return None if the process was terminated by a signal."
|
||||||
In that case, ExitStatusExt::signal should never return None.
|
In that case, ExitStatusExt::signal should never return None.
|
||||||
*/
|
*/
|
||||||
status.code().or_else(|| status.signal())
|
status.code().or_else(||
|
||||||
|
/* To differentiate between "normal" exit codes and signals, we are using
|
||||||
|
something similar to bash exit codes (https://tldp.org/LDP/abs/html/exitcodes.html)
|
||||||
|
by adding 128 to a signal integer value.
|
||||||
|
*/
|
||||||
|
status.signal().map(|s| 128 + s))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
|
|||||||
Reference in new issue
Block a user