zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Prompt for confirmation avec Ctrl+C
Date: Thu, 12 May 2011 23:18:43 -0700	[thread overview]
Message-ID: <110512231843.ZM14741@torch.brasslantern.com> (raw)
In-Reply-To: <20110512193033.GA28413@yeeloong.happyleptic.org>

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.


      reply	other threads:[~2011-05-13  6:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-12 19:30 rixed
2011-05-13  6:18 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=110512231843.ZM14741@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).