Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Prompt for confirmation avec Ctrl+C



On May 12,  9:30pm, rixed@xxxxxxxxxxxxxxx wrote:
} 
} Yesterday I killed inadvertantly a running job with Ctrl+C,
} and I told to myself it would be nice if the shell were asking
} for confirmation before doing such a thing.

Unfortunately this generally isn't possible.  When a command starts
in the foreground, the shell has relinquished control of the terminal.
The command gets all terminal input directly, including any signals
that are generated by by keys that are bound to stty actions like
intr, quit, and susp.

The shell only finds out what happened after the foreground job has
exited (or stopped, in the case of ^Z [susp]).

In order to trap and confirm keystrokes, you'd need a full terminal
emulator intercepting everything that goes to/from the job.  Perhaps
"screen" has a way to do something like what you want.



Messages sorted by: Reverse Date, Date, Thread, Author