mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
Handle interactive & login shells, SHLVL checks, and better message.
This commit is contained in:
parent
6334047ebd
commit
239d2a28e1
@ -1,7 +1,18 @@
|
|||||||
function suspend -d "Suspend the current shell so long as it is not a login shell."
|
# If the user hasn't set it, make sure our test level has a value
|
||||||
if status --is-login
|
if not set -q suspend_minimum_SHLVL
|
||||||
echo cannot suspend login shell >&2
|
set -g suspend_minimum_SHLVL 3
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function suspend -d "Suspend the current shell."
|
||||||
|
if begin contains -- $argv --force
|
||||||
|
or not status --is-interactive
|
||||||
|
or begin test $SHLVL -ge $suspend_minimum_SHLVL
|
||||||
|
and not status --is-login
|
||||||
|
end
|
||||||
|
end
|
||||||
|
kill -STOP %self
|
||||||
else
|
else
|
||||||
kill -STOP %self
|
echo 2>&1 Cannot suspend login shell or SHLVL to low, use --force to force.
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user