summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-11-13 13:54:10 -0500
committerJesse Luehrs <doy@tozt.net>2021-11-13 13:54:10 -0500
commitd8ddced881672115f7dd7b7d5199190d5b80a60f (patch)
treebd8cd7c886888efa99898b6c8dd049caceb872ac /src
parent4b6bf2141459caf628f952678bf886a18927d8d2 (diff)
downloadnbsh-d8ddced881672115f7dd7b7d5199190d5b80a60f.tar.gz
nbsh-d8ddced881672115f7dd7b7d5199190d5b80a60f.zip
display the name of termination signals, if possible
Diffstat (limited to 'src')
-rw-r--r--src/history.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/history.rs b/src/history.rs
index 83744ce..cca3114 100644
--- a/src/history.rs
+++ b/src/history.rs
@@ -228,7 +228,13 @@ impl History {
);
if let Some(status) = entry.exit_status {
if let Some(sig) = status.signal() {
- out.write_str(&format!("SIG{} ", sig));
+ if let Some(name) =
+ signal_hook::low_level::signal_name(sig)
+ {
+ out.write_str(&format!("{} ", &name[3..]));
+ } else {
+ out.write_str(&format!("SIG{} ", sig));
+ }
} else {
out.write_str(&format!("{} ", status.code().unwrap()));
}