Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: and lists and suspended processes



On Sun, 2 Jan 2005, Clint Adams wrote:

> Should zsh wait for a suspended process to exit before continuing along
> the sublist?

I believe I was involved in a related discussion not that long ago.  
Trouble is, I can't recall if it was on zsh-workers or austin-group or 
somewhere else, and searching the zsh archives isn't helping me.

The short answer is, no, zsh can't wait for the suspended process to exit.

Given "one && two && three", if "two" stops, the shell has three choices:
(1) pretend the command was "{ one && two && three }" and suspend the 
    entire sublist; or
(2) pretend that "two" has returned a status and continue the junction; or
(3) stop the entire shell until "two" is resumed.

Choice (1) is undesirable because it subverts the user's intent (if he 
meant there to be braces, he should have typed them) and it puts "three" 
into a separate process when it might better have been run in the current 
shell.  Choice (3) is impossible in an interactive shell.  That leaves 
(2), which is what zsh does, using the signal number as the status.

If there's a bug, it's that zsh returns $? == 20 rather than $? == 148.
I forget why that's done -- maybe it's a compromise because $? > 127 would
indicate the signal caused the child to exit, which is not the case here.



Messages sorted by: Reverse Date, Date, Thread, Author