Note: script refers to the script command,
which logs stdin and stdout to files.
I was trying to run a script with the script utility to save output
for later inspection while preserving text colors on terminal.
- When I try to suspend the current script
with Ctrl+Z (
SIGTSTP), the console prints^Zand the script just won't stop. - I then tried Ctrl+S
(. The script currently running does freeze (SIGSTOP)htopshows all process asZmode), though it does not release the terminal. Ctrl+Q does resume them.
I'm now confused why
Ctrl+S works
but SIGSTOPSIGTSTP (Ctrl+Z) doesn’t.
I know SIGTSTP can be trapped, but I don't see any reason to do that,
and there's nothing about it in script’s manual page.
I tried to force the script interpreter to interactive mode,
but the result makes me more confused.
Issuing Ctrl+Z (SIGTSTP)
does suspend the running script,
but script says scripts are finished and then exited,
which kills all suspended child processes.
Is there a way to allow suspend normally in such situation? Also, can someone explain exactly what happened?