From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7238 invoked by alias); 13 May 2011 06:18:53 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16025 Received: (qmail 12808 invoked from network); 13 May 2011 06:18:50 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110512231843.ZM14741@torch.brasslantern.com> Date: Thu, 12 May 2011 23:18:43 -0700 In-reply-to: <20110512193033.GA28413@yeeloong.happyleptic.org> Comments: In reply to rixed@happyleptic.org "Prompt for confirmation avec Ctrl+C" (May 12, 9:30pm) References: <20110512193033.GA28413@yeeloong.happyleptic.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Prompt for confirmation avec Ctrl+C MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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.