From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4396 invoked by alias); 20 Feb 2012 18:33:52 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30243 Received: (qmail 20850 invoked from network); 20 Feb 2012 18:33:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at vinc17.net does not designate permitted sender hosts) Date: Mon, 20 Feb 2012 19:33:35 +0100 From: Vincent Lefevre To: zsh-workers@zsh.org Subject: Re: suspend (^Z) behavior while a function is running is unclear Message-ID: <20120220183335.GE7797@xvii.vinc17.org> Mail-Followup-To: zsh-workers@zsh.org References: <20120220130259.GB7797@xvii.vinc17.org> <20120220151309.4cc1a83d@pwslap01u.europe.root.pri> <20120220160944.GC7797@xvii.vinc17.org> <20120220163557.672588e2@pwslap01u.europe.root.pri> <120220094100.ZM359@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <120220094100.ZM359@torch.brasslantern.com> X-Mailer-Info: http://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.21-6201-vl-r48020 (2011-12-20) On 2012-02-20 09:41:00 -0800, Bart Schaefer wrote: > On Feb 20, 4:35pm, Peter Stephenson wrote: > > Subject: Re: suspend (^Z) behavior while a function is running is unclear > > > > On Mon, 20 Feb 2012 17:09:45 +0100 > > Vincent Lefevre wrote: > > > Now I'm thinking whether there should be an option to control that. > > > Indeed, some functions may fail to work correctly if they are suspended > > > in such a way. Some functions or { list } could be marked as not > > > backgroundable, e.g. by setting an option at the beginning, in which > > > case the ^Z could be ignored. > > This is already partly in place: > > 2011-08-14 Barton E. Schaefer > > * 29677: Src/exec.c, Src/signals.c, Src/zsh.h: flag jobs that are > builtins running in the current shell, and if they control a > pipeline, do not allow the external processes in that pipeline to > become suspended when the foreground shell cannot suspend. > > torch% foreach foo (a b c) { sleep 5 } | : > zsh: job can't be suspended However if the command outputs something, one loses the output. > > Useful, but I'm not sure an option is the right way of doing this... I > > should think you'd want to do something like: > > > > { > > stty susp undef > > ... > > } always { > > stty susp '^z' > > } > > I'm not sure that's the right semantics. Does one want to disable the > tty suspend character or just ingore the TSTP signal? What if "emacs" > in the original example was replaced by running another shell? The ^Z should affect only the other shell. So, I think this is OK. But with the encapsulation (to save typing), this is very limited. For instance, one cannot use a complex command like: nosuspend for i in ... or even use a function after "nosuspend". -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)