mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-28 07:46:28 +00:00
fix(bash): Clear out completed jobs before counting NUM_JOBS (#5253)
Clear out completed jobs before counting NUM_JOBS
This commit is contained in:
parent
0dfca07255
commit
0a05b5ca8b
@ -37,6 +37,18 @@ starship_precmd() {
|
||||
STARSHIP_PIPE_STATUS=(${BP_PIPESTATUS[@]})
|
||||
fi
|
||||
|
||||
# Due to a bug in certain Bash versions, any external process launched
|
||||
# inside $PROMPT_COMMAND will be reported by `jobs` as a background job:
|
||||
#
|
||||
# [1] 42135 Done /bin/echo
|
||||
#
|
||||
# This is a workaround - we run `jobs` once to clear out any completed jobs
|
||||
# first, and then we run it again and count the number of jobs.
|
||||
#
|
||||
# More context: https://github.com/starship/starship/issues/5159
|
||||
# Original bug: https://lists.gnu.org/archive/html/bug-bash/2022-07/msg00117.html
|
||||
jobs &>/dev/null
|
||||
|
||||
local NUM_JOBS=0
|
||||
# Evaluate the number of jobs before running the preserved prompt command, so that tools
|
||||
# like z/autojump, which background certain jobs, do not cause spurious background jobs
|
||||
|
Loading…
Reference in New Issue
Block a user