Skip to content

Commit

Permalink
Fix 'can't manipulate jobs in subshell' error in zsh
Browse files Browse the repository at this point in the history
  • Loading branch information
geksiong authored and guenhter committed Feb 21, 2023
1 parent 63e75f8 commit b4195a0
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions gitprompt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ function async_run() {
}&
}

function set_git_prompt_dir() {
function async_run_zsh() {
{
eval "$@" &> /dev/null
}&!
}


function git_prompt_dir() {
# assume the gitstatus.sh is in the same directory as this script
# code thanks to http://stackoverflow.com/questions/59895
if [ -z "$__GIT_PROMPT_DIR" ]; then
__GIT_PROMPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
Expand Down Expand Up @@ -441,8 +449,12 @@ function checkUpstream() {
then
if [[ -n $(git remote show) ]]; then
(
async_run "GIT_TERMINAL_PROMPT=0 git fetch --quiet"
disown -h
if [ -n $ZSH_VERSION ]; then
async_run_zsh "GIT_TERMINAL_PROMPT=0 git fetch --quiet"
else
async_run "GIT_TERMINAL_PROMPT=0 git fetch --quiet"
disown -h
fi
)
fi
fi
Expand Down

0 comments on commit b4195a0

Please sign in to comment.