From: Chris Lindee Date: Mon, 16 Feb 2026 06:47:15 +0000 (-0600) Subject: profile/systemd-osc-context: Acknowledge uncertainty X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b88ab1c2dd8896a4bb710316b6a949817ef8d859;p=thirdparty%2Fsystemd.git profile/systemd-osc-context: Acknowledge uncertainty Bash does not provide an easy way to discern if an exit status came from a signal, or was a legitimate non-zero exit (i.e. a failure). It can be done, by using job control or by invoking another program; however, such approaches require modifying the command entered by a user and are, thus, invasive and risky. Since an exit status of 129 on a command could either indicate it exited cleanly with `exit(129)` or was interrupted by `SIGHUP`, the osc context should report both possibilities, to acknowledge our uncertainty. Given we have no idea what happened, besides an unsuccessful exit, the exit is described as `exit=failure`. Moreover, discerning between an `interrupt` and a `crash` with a command likely involves categorizing every signal. It is fairly obvious `SIGINT` is an interrupt and also obvious, IMO, that `SIGSEGV` is a crash. Avoid the complication (and potential disagreements) by using the encompassing, generic value — one that remains true if no signal occurred. References: [0] https://stackoverflow.com/a/66431355 --- diff --git a/profile.d/80-systemd-osc-context.sh b/profile.d/80-systemd-osc-context.sh index c7a556f66ad..df7f93afa3a 100644 --- a/profile.d/80-systemd-osc-context.sh +++ b/profile.d/80-systemd-osc-context.sh @@ -44,7 +44,7 @@ __systemd_osc_context_precmdline() { # Close previous command if [ -n "${systemd_osc_context_cmd_id:-}" ]; then if [ "$systemd_exitstatus" -gt 128 ] && systemd_signal=$(kill -l "$systemd_exitstatus" 2>&-); then - printf "\033]3008;end=%s;exit=interrupt;signal=SIG%s\033\\" "$systemd_osc_context_cmd_id" "$systemd_signal" + printf "\033]3008;end=%s;exit=failure;status=%s;signal=SIG%s\033\\" "$systemd_osc_context_cmd_id" "$systemd_exitstatus" "$systemd_signal" elif [ "$systemd_exitstatus" -ne 0 ]; then printf "\033]3008;end=%s;exit=failure;status=%s\033\\" "$systemd_osc_context_cmd_id" $((systemd_exitstatus)) else