fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Nahorcolor: prefer `set_color --reset` over `set_color normal`867946468

master
838 B30 linesraw
1# localization: tier1
2
3function suspend --description 'Suspend the current shell.'
4    set -l options h/help f/force
5    argparse -n suspend --max-args=1 $options -- $argv
6    or return
7
8    if set -q _flag_help
9        __fish_print_help suspend
10        return 0
11    end
12
13    if not set -q _flag_force
14        and status is-login
15        and status is-interactive
16
17        echo 2>&1 'Refusing to suspend interactive login shell.'
18        echo 2>&1 'Use --force to override. This might hang your terminal.'
19        return 1
20    end
21
22    if status is-interactive
23        echo -ns 'Suspending ' $fish_pid ': run'
24        echo -n (set_color --bold) 'kill -CONT' $fish_pid (set_color --reset)
25        echo 'from another terminal to resume'
26    end
27
28    # XXX always causes a zombie until one fg's when we do this:
29    kill -STOP $fish_pid
30end