Merge lp:~donadigo/elementaryos/os-patch-bash-preexec-save-exit-status into lp:~elementary-os/elementaryos/os-patch-bash-xenial

Proposed by Adam Bieńkowski
Status: Merged
Merged at revision: 3
Proposed branch: lp:~donadigo/elementaryos/os-patch-bash-preexec-save-exit-status
Merge into: lp:~elementary-os/elementaryos/os-patch-bash-xenial
Diff against target: 29 lines (+3/-2)
1 file modified
debian/etc.bash_preexec (+3/-2)
To merge this branch: bzr merge lp:~donadigo/elementaryos/os-patch-bash-preexec-save-exit-status
Reviewer Review Type Date Requested Status
elementary OS team Pending
Review via email: mp+333716@code.launchpad.net

Commit message

* Save exit status in bash_preexec.

Description of the change

Save the status of last command so that we can access it in PROMPT_COMMAND envvar. This will be useful for Terminal to show the status icon for last command.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/etc.bash_preexec'
2--- debian/etc.bash_preexec 2016-01-02 03:50:13 +0000
3+++ debian/etc.bash_preexec 2017-11-14 22:37:11 +0000
4@@ -68,6 +68,7 @@
5 # run interactively by the user; it's set immediately after the prompt hook,
6 # and unset as soon as the trace hook is run.
7 __bp_preexec_interactive_mode=""
8+__bp_last_ret_value=""
9
10 __bp_trim_whitespace() {
11 local var=$@
12@@ -89,7 +90,7 @@
13 __bp_precmd_invoke_cmd() {
14
15 # Should be available to each precmd function, should it want it.
16- local ret_value="$?"
17+ __bp_last_ret_value="$?"
18
19 # For every function defined in our function array. Invoke it.
20 local precmd_function
21@@ -97,7 +98,7 @@
22
23 # Only execute this function if it actually exists.
24 if [[ -n $(type -t $precmd_function) ]]; then
25- __bp_set_ret_value $ret_value
26+ __bp_set_ret_value $__bp_last_ret_value
27 $precmd_function
28 fi
29 done

Subscribers

People subscribed via source and target branches