From 9642fcb589d977cfa5ad03d6525ba2442e4ed93f Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Fri, 1 Jul 2016 01:18:07 -0700 Subject: [PATCH] Update suspend docs. When used, show how to resume Fixes #3154 --- doc_src/suspend.txt | 8 +++----- share/functions/suspend.fish | 14 ++++++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/doc_src/suspend.txt b/doc_src/suspend.txt index defde22de..0fc9485b6 100644 --- a/doc_src/suspend.txt +++ b/doc_src/suspend.txt @@ -10,8 +10,6 @@ suspend [--force] `suspend` suspends execution of the current shell by sending it a SIGTSTP signal, returning to the controlling process. It can be 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 -the shell if it is a login shell or if `$SHLVL` is less -`$suspend_minimum_SHLVL`, which defaults to three. This test is -skipped if the `--force` option is given or the shell is not -interactive. +a shell that doesn't have a controlling process, it will not suspend +the shell if it is a login shell. This requirement is bypassed +if the `--force` option is given or the shell is not interactive. \ No newline at end of file diff --git a/share/functions/suspend.fish b/share/functions/suspend.fish index 295b9f341..46f7b5e64 100644 --- a/share/functions/suspend.fish +++ b/share/functions/suspend.fish @@ -1,10 +1,16 @@ function suspend -d "Suspend the current shell." if begin contains -- $argv --force or not status --is-interactive and not status --is-login - end - echo Suspending %self - kill -STOP %self + end + 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 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