Skip to content

Commit d5e5902

Browse files
committed
.bashrc: Emit BEL on non-zero exit codes for long-running processes
1 parent ba54b45 commit d5e5902

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.bashrc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export PATH_WIDTH=50
2929
# set window title and terminal prompt
3030
# embed git status information if available
3131
set_prompt() {
32+
# emit BEL on non-zero exit codes, ignore SIGINT
33+
_exit=$?; [ $_exit -gt 0 ] && [ $_exit -ne 130 ] && printf '\a'
34+
3235
if [ ! -z $COLOR ]; then
3336
u='\[\e[1;32m\]' # user/hostname color
3437
p='\[\e[1;34m\]' # path color
@@ -46,9 +49,10 @@ set_prompt() {
4649
|| path="$(path-shorthand)" \
4750
|| path="('${PWD##*/}' no longer exists)" # no such file or directory
4851
PS1="\[\e]0;\u@\h: \w\a\]${u}\u@\h${r}:${git_path:-${p}${path}${r}}\$ "
49-
unset u p r path git_path
52+
unset _exit u p r path git_path
5053
export PROMPT_LATENCY=$((${EPOCHREALTIME%.*}${EPOCHREALTIME#*.} - TIME_NOW))
5154

55+
5256
# command history persistence across sessions
5357
history -a; history -c; history -r
5458
}

0 commit comments

Comments
 (0)