zsh-users
 help / color / mirror / code / Atom feed
* killing commands in a pipe?
@ 1999-06-14 18:12 Dominik Vogt
       [not found] ` <990614101726.ZM19345@candle.brasslantern.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Dominik Vogt @ 1999-06-14 18:12 UTC (permalink / raw)
  To: zsh-users

I have a problem with a shell script:

  #!/usr/bin/zsh
  setopt NOHUP
  some_command_that_never_exits |
  while true; do
    read LINE
    ...
  done

I start the script from another script with

  my_script &

and I try to kill it with

  killall some_command_that_never_exits

The problem is that although some_command_that_never_exits is
killed as expected, the 'while' part of the pipe doesn't exit.
Actually it's worse than that because the zsh running the command
refuses to be killed, even with kill -9. If I unset the NOHUP
option instead:

  unsetopt NOHUP

it works ok. The manpage says this about the (NO)HUP option:

  HUP    Send the HUP signal to running jobs when the shell exits.

So this doesn't explain the behaviour. Shouldn't the pipe exit
completely when the input stream is broken, regardless of the
HUP/NOHUP option?

I am using zsh 3.0.5 u'on a Linux 2.2.5 kernel.

(please cc me, I'm not on the list)

Bye

Dominik ^_^

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, dominik_vogt@hp.com


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

* Re: killing commands in a pipe?
       [not found] ` <990614101726.ZM19345@candle.brasslantern.com>
@ 1999-06-14 20:38   ` Dominik Vogt
  0 siblings, 0 replies; 3+ messages in thread
From: Dominik Vogt @ 1999-06-14 20:38 UTC (permalink / raw)
  To: schaefer, zsh-users

On Mon, Jun 14, 1999 at 10:17:26AM +0000, schaefer@candle.brasslantern.com wrote:
> On Jun 14, 12:12pm, Dominik Vogt wrote:
> } Subject: killing commands in a pipe?
> }
> } The problem is that although some_command_that_never_exits is
> } killed as expected, the 'while' part of the pipe doesn't exit.
> 
> Try grabbing the patches from ftp://ftp.brasslantern.com/pub/zsh/ to
> build 3.0.6-pre-4, and let me know if the problem persists there.

Yes, the problem is still there. BTW, I must have overlooked this
when I wrote my first mail: the setting of HUP/NOHUP does not matter,
the problem occurs in both cases.

Bye

Dominik ^_^

-- 
Dominik Vogt, Hewlett-Packard GmbH, Dept. BVS
Herrenberger Str.130, 71034 Boeblingen, Germany
phone: 07031/14-4596, fax: 07031/14-3883, dominik_vogt@hp.com


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

* Re: killing commands in a pipe?
@ 1999-06-15  7:28 Sven Wischnowsky
  0 siblings, 0 replies; 3+ messages in thread
From: Sven Wischnowsky @ 1999-06-15  7:28 UTC (permalink / raw)
  To: zsh-users


Dominik Vogt wrote:

> On Mon, Jun 14, 1999 at 10:17:26AM +0000, schaefer@candle.brasslantern.com wrote:
> > On Jun 14, 12:12pm, Dominik Vogt wrote:
> > } Subject: killing commands in a pipe?
> > }
> > } The problem is that although some_command_that_never_exits is
> > } killed as expected, the 'while' part of the pipe doesn't exit.
> > 
> > Try grabbing the patches from ftp://ftp.brasslantern.com/pub/zsh/ to
> > build 3.0.6-pre-4, and let me know if the problem persists there.
> 
> Yes, the problem is still there. BTW, I must have overlooked this
> when I wrote my first mail: the setting of HUP/NOHUP does not matter,
> the problem occurs in both cases.

Sorry I didn't try it yesterday...

The problem is that we have all this code in update_job() that handles 
such cases, but only if MONITOR is set -- which it isn't in a script-
shell.

I can only hope that the patch has no negative effects -- it is for
pws-21. I haven't tried it but I think it should also work with
3.0.5-pre-4.

Bye
 Sven

--- os/jobs.c	Mon Jun 14 09:16:19 1999
+++ Src/jobs.c	Tue Jun 15 09:16:27 1999
@@ -240,8 +240,11 @@
 		adjustwinsize(0);
 	    }
 	}
+    } else if (list_pipe && (val & 0200) && inforeground == 1) {
+	breaks = loops;
+	errflag = 1;
+	inerrflush();
     }
-
     if (somestopped && jn->stat & STAT_SUPERJOB)
 	return;
     jn->stat |= (somestopped) ? STAT_CHANGED | STAT_STOPPED :

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

end of thread, other threads:[~1999-06-15  7:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-14 18:12 killing commands in a pipe? Dominik Vogt
     [not found] ` <990614101726.ZM19345@candle.brasslantern.com>
1999-06-14 20:38   ` Dominik Vogt
1999-06-15  7:28 Sven Wischnowsky

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).