From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7357 invoked from network); 21 Jun 1999 16:16:52 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 21 Jun 1999 16:16:52 -0000 Received: (qmail 10256 invoked by alias); 21 Jun 1999 16:16:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6770 Received: (qmail 10249 invoked from network); 21 Jun 1999 16:16:43 -0000 From: "Andrej Borsenkow" To: "Bart Schaefer" , Subject: RE: pws-22: killing the ZSH loops problem Date: Mon, 21 Jun 1999 20:14:52 +0400 Message-ID: <000501bebc01$319cc760$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-Mimeole: Produced By Microsoft MimeOLE V5.00.2314.1300 In-Reply-To: <990621155542.ZM23581@candle.brasslantern.com> > } > } > } We need it only if MONITOR is set > } > > } > Not true! MONITOR only affects handling of ^Z, not of ^C. We need to be > } > able to properly interrupt such loops in any shell. > } > } Ahem ... yes. What about "only in interactive shells?" > > What about "kill -INT"? What about a shell script that isn't interactive > but that's running in the foreground? > The shell script running in foreground will get INT from tty because it is in TTY group and can do anything with it. The same, if I do kill -INT. The problem only ever happens with loops started as part of shells with MIONITOR option set, because it runs part of command (loop) in other process group as loop itself. That prevents it from seeing this INT. > } If don't miss something again: we have to fork only for the loop as whole. > > That's right, but the reason we don't do this now is so that parameter > assignments inside the loop are visible after the loop terminates. That > doesn't work in most other shells. > As I understand, the last part of pipeline runs in current shell, and Sven's suggestion was basically to run while ... done loop as | while ... loop. May be, I was wrong. And another way is to run commands in the process group as shell and catch INT. Is it even remotely possible? > } ... so, it seems, execution time penalty is acceptable. After all, you > } don't use loops on every prompt. > > The execution time isn't as much at issue as is the process table space. > If it is needed (as I still believe) only for loops, started at PS1 when MONITOR is set - it hardly happens too often. And having to kill your login shell to get out of loop is not as nice