mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
parent
cbee315b1b
commit
9642fcb589
2 changed files with 13 additions and 9 deletions
|
@ -10,8 +10,6 @@ suspend [--force]
|
||||||
`suspend` suspends execution of the current shell by sending it a
|
`suspend` suspends execution of the current shell by sending it a
|
||||||
SIGTSTP signal, returning to the controlling process. It can be
|
SIGTSTP signal, returning to the controlling process. It can be
|
||||||
resumed later by sending it a SIGCONT. In order to prevent suspending
|
resumed later by sending it a SIGCONT. In order to prevent suspending
|
||||||
a shell that doesn't have a controlling process, it will not suspend a
|
a shell that doesn't have a controlling process, it will not suspend
|
||||||
the shell if it is a login shell or if `$SHLVL` is less
|
the shell if it is a login shell. This requirement is bypassed
|
||||||
`$suspend_minimum_SHLVL`, which defaults to three. This test is
|
if the `--force` option is given or the shell is not interactive.
|
||||||
skipped if the `--force` option is given or the shell is not
|
|
||||||
interactive.
|
|
|
@ -2,9 +2,15 @@ function suspend -d "Suspend the current shell."
|
||||||
if begin contains -- $argv --force
|
if begin contains -- $argv --force
|
||||||
or not status --is-interactive and not status --is-login
|
or not status --is-interactive and not status --is-login
|
||||||
end
|
end
|
||||||
echo Suspending %self
|
echo "Suspending" %self
|
||||||
|
echo -n (set_color --bold)" fg"(set_color normal) to resume
|
||||||
|
if contains -- $argv --force
|
||||||
|
echo " (or"(set_color --bold) "kill -CONT" %self (set_color normal)"from another terminal)"
|
||||||
|
end
|
||||||
|
|
||||||
kill -STOP %self
|
kill -STOP %self
|
||||||
else
|
else
|
||||||
echo 2>&1 Cannot suspend login shell. Use --force to override.
|
echo 2>&1 "Refusing to suspend login shell. Use --force to override."
|
||||||
|
echo 2>&1 "This might hang your terminal."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue