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

Re: unable to wait on completed job [was: should $! give the pid of subshell?]

On Nov 30,  6:37pm, Peter Stephenson wrote:
} If it's only an issue for $! (lastpid internally), I think it's fairly
} straightforward to fix. I tried to make it work even if a new process
} with the same PID came along later.

This looks reasonable, but I wonder if we should make it conditional

} No idea about anything to do with SIGTTOU, however, that's outside my
} range.

SIGTTOU is only a side-effect.  The doc for POSIX_JOBS says:

    ... When the option is set, the MONITOR option and job control
    remain active in the subshell ... 

What's happening is that the subshell is not the tty process group
leader, so when MONITOR tries to print the job number and PID (and
later the exit status), the TTY driver stops it because it doesn't
appear to be the foreground job.

What's odder is that "stty -tostop" doesn't prevent this.  Something is
effectively reasserting that setting before the subshell gets going.

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