zsh-users
 help / color / mirror / code / Atom feed
* Prompt for confirmation avec Ctrl+C
@ 2011-05-12 19:30 rixed
  2011-05-13  6:18 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: rixed @ 2011-05-12 19:30 UTC (permalink / raw)
  To: zsh-users

Hello list!

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.

Then, thinking that if a shell can do that it's probably zsh, I
wanted to ask here: is such a thing implemented in zsh already?
Is it doable at all?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Prompt for confirmation avec Ctrl+C
  2011-05-12 19:30 Prompt for confirmation avec Ctrl+C rixed
@ 2011-05-13  6:18 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2011-05-13  6:18 UTC (permalink / raw)
  To: zsh-users

On May 12,  9:30pm, rixed@happyleptic.org 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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-13  6:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-12 19:30 Prompt for confirmation avec Ctrl+C rixed
2011-05-13  6:18 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).