zsh-workers
 help / color / mirror / code / Atom feed
* suspend while loop.
@ 2000-05-16 18:41 Tanaka Akira
  2000-05-16 19:02 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Tanaka Akira @ 2000-05-16 18:41 UTC (permalink / raw)
  To: zsh-workers

Z(4):akr@serein% Src/zsh -f
serein% cat |while read line; do echo $line; done
<C-z>

This doesn't suspend the job.

Z(4):akr@serein% ps jax|sed -n -e 1p -e /2380/p
 PPID   PID  PGID   SID TTY      TPGID STAT   UID   TIME COMMAND
28769  2380  2380 28769 ttyp5     2381 S    23483   0:00 Src/zsh -f
 2380  2381  2381 28769 ttyp5     2381 T    23483   0:00 cat
28772  2393  2392 28772 ttyp9     2392 S    23483   0:00 sed -n -e 1p -e /2380/p

`cat' is suspended.  But zsh wait something yet...
-- 
Tanaka Akira


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

* Re: suspend while loop.
  2000-05-16 18:41 suspend while loop Tanaka Akira
@ 2000-05-16 19:02 ` Bart Schaefer
  2000-05-18  6:55   ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2000-05-16 19:02 UTC (permalink / raw)
  To: Tanaka Akira, zsh-workers

On May 17,  3:41am, Tanaka Akira wrote:
> Subject: suspend while loop.
> Z(4):akr@serein% Src/zsh -f
> serein% cat |while read line; do echo $line; done
> <C-z>
> 
> `cat' is suspended.  But zsh wait something yet...

I think you can't break out of `read' with ^Z.  Try it without the cat|
and you'll find you can't suspend the loop.


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

* Re: suspend while loop.
  2000-05-16 19:02 ` Bart Schaefer
@ 2000-05-18  6:55   ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2000-05-18  6:55 UTC (permalink / raw)
  To: zsh-workers

On May 16, 12:02pm, Bart Schaefer wrote:
} Subject: Re: suspend while loop.
}
} > Z(4):akr@serein% Src/zsh -f
} > serein% cat |while read line; do echo $line; done
} > <C-z>
} > 
} > `cat' is suspended.  But zsh wait something yet...
} 
} I think you can't break out of `read' with ^Z.  Try it without the cat|
} and you'll find you can't suspend the loop.

Does anyone have any insights on this?  I was about to announce 3.0.8,
but discovered that this loop is not suspendable there either.  I don't
have much time for debugging it myself this week ...

If it doesn't appear to be easily fixed, I'm going to go ahead and put
3.0.8 out anyway.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* Re: suspend while loop.
@ 2000-05-18  8:37 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-05-18  8:37 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> On May 16, 12:02pm, Bart Schaefer wrote:
> } Subject: Re: suspend while loop.
> }
> } > Z(4):akr@serein% Src/zsh -f
> } > serein% cat |while read line; do echo $line; done
> } > <C-z>
> } > 
> } > `cat' is suspended.  But zsh wait something yet...
> } 
> } I think you can't break out of `read' with ^Z.  Try it without the cat|
> } and you'll find you can't suspend the loop.
> 
> Does anyone have any insights on this?  I was about to announce 3.0.8,
> but discovered that this loop is not suspendable there either.  I don't
> have much time for debugging it myself this week ...
> 
> If it doesn't appear to be easily fixed, I'm going to go ahead and put
> 3.0.8 out anyway.

I can't see how we could (really) make in suspendible. For that we
would need to be able to get out of the read, back to the place where
we can create the sub-shell for the loop. Then, on continuing, we
would need to be able to go into the same read and continue with
it. But the first thing can only be done by returing from the
read. Everyone can easily test this by adding child_unblock() before
the read() in zread() and child_unblock()s after it. This makes the
loop suspendible, but when it is continued, the loop exits immediately
because the read that was suspended returned non-zero.

Depending on personal taste it is either ugly that the cat gets
suspended or that we can't ^C out of the loop after the ^Z.

I've no idea how to solve this.

Bye
 Sven


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


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

end of thread, other threads:[~2000-05-18  8:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-16 18:41 suspend while loop Tanaka Akira
2000-05-16 19:02 ` Bart Schaefer
2000-05-18  6:55   ` Bart Schaefer
2000-05-18  8:37 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).