Skip to content

Commit

Permalink
style: Add comments for bash preexec fix (starship#1952)
Browse files Browse the repository at this point in the history
* Add comments for bash fix

* Rewrite commend
  • Loading branch information
chipbuster committed Jan 14, 2021
1 parent 1e503c3 commit 91f2a4a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/init/starship.bash
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ starship_precmd() {
# Save the status, because commands in this pipeline will change $?
STATUS=$?

# Evaluate the number of jobs before running the preseved prompt command, so that tools
# like z/autojump, which background certain jobs, do not cause spurious background jobs
# to be displayed by starship. Also avoids forking to run `wc`, slightly improving perf
NUM_JOBS=$(n=0; while read line; do [[ $line ]] && n=$((n+1));done <<< $(jobs -p) ; echo $n)

# Run the bash precmd function, if it's set. If not set, evaluates to no-op
Expand Down

0 comments on commit 91f2a4a

Please sign in to comment.