]> git.ipfire.org Git - thirdparty/util-linux.git/commit
script: support sig{stop/cont}
authorKarel Zak <kzak@redhat.com>
Fri, 8 Sep 2017 07:48:29 +0000 (09:48 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 8 Sep 2017 07:48:29 +0000 (09:48 +0200)
commit2e7a92270114cc652ea090251a374e917adb7a72
tree384be775e19047b3d4c171d5e51eaf39e2eb304e
parente12364cdfb2c8046bfe34f18af9583f1dcf934c9
script: support sig{stop/cont}

* call wait() only when child exited
* suspend all session (including script master process) when child get
  SIGSTOP and send SIGCONT to child when master process resume

This allows to suspend all session and later use "fg" shell command to
resume.

$ ps af
14722 pts/1    Ss     0:00 bash
 4870 pts/1    S+     0:00  \_ ./script
 4871 pts/6    Ss+    0:00      \_ bash -i

$ kill -SIGSTOP 4871

and script session on another terminal:

$ script
Script started, file is typescript

[1]+  Stopped                 ./script

$ fg 1
./script

... session again usable ...
^D
Script done, file is typescript

Signed-off-by: Karel Zak <kzak@redhat.com>
term-utils/script.c