aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/suspend.fish
blob: 32cdfa90c6c28798faa673892708d0461c00c8bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# If the user hasn't set it, make sure our test level has a value
if not set -q suspend_minimum_SHLVL
    set -g suspend_minimum_SHLVL 2
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
       echo Suspending %self
       kill -STOP %self
    else
       echo 2>&1 Cannot suspend login shell or SHLVL to low, use --force to force.
    end
end