mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-11 00:10:08 +00:00
Avoid error messages when there is no job
This commit is contained in:
parent
c1446b4750
commit
902e3172c9
1 changed files with 10 additions and 7 deletions
|
@ -72,19 +72,22 @@ function omz_termsupport_preexec {
|
||||||
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
|
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
|
||||||
local LINE="${2:gs/%/%%}"
|
local LINE="${2:gs/%/%%}"
|
||||||
|
|
||||||
|
# replace fg, possibly with argument, with description from jobs
|
||||||
if [[ "$CMD" = fg ]]; then
|
if [[ "$CMD" = fg ]]; then
|
||||||
# replace fg, possibly with argument, with description from jobs
|
|
||||||
local JOB
|
local JOB
|
||||||
if [[ ${(z)1} = fg ]]; then # no arguments
|
if [[ ${(z)1} = fg ]]; then # no arguments
|
||||||
JOB="$(jobs %%)"
|
JOB="$(jobs %% 2>/dev/null)"
|
||||||
else # arguments
|
else # arguments
|
||||||
JOB="$(jobs ${${(z)1}[2]})"
|
JOB="$(jobs ${${(z)1}[2]} 2>/dev/null)"
|
||||||
|
fi
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
|
JOB="${${(z)JOB}[4,$]}" # trim job number, +, pid, status
|
||||||
|
title ${JOB:gs/%/%%} ${JOB:gs/%/%%}
|
||||||
|
return
|
||||||
fi
|
fi
|
||||||
JOB="${${(z)JOB}[4,$]}" # trim job number, +, pid, status
|
|
||||||
title ${JOB:gs/%/%%} ${JOB:gs/%/%%}
|
|
||||||
else
|
|
||||||
title '$CMD' '%100>...>$LINE%<<'
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
title '$CMD' '%100>...>$LINE%<<'
|
||||||
}
|
}
|
||||||
|
|
||||||
precmd_functions+=(omz_termsupport_precmd)
|
precmd_functions+=(omz_termsupport_precmd)
|
||||||
|
|
Loading…
Reference in a new issue