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

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



>>>>> On November 25, 2009 Peter Stephenson <pws@xxxxxxx> wrote:

> zsh "exec"s the final
> command since it notices the subshell isn't needed any more so there's
> no point in forking.

Oh cool, I didn't realize zsh did tail recursion..

OK, so let me change the question a bit.  If I run this script:

  #!/bin/zsh -f
  sleep 10 &
  pid=$!
  sleep 12
  wait $pid

I get the error:

| zshbgtest.zsh:wait:12: pid 19673 is not a child of this shell

Using bash or ksh, I can successfully wait on the completed job.

Shouldn't I be able to wait on a job that has completed in zsh?

This is zsh 4.3.10-dev-1, patchlevel 1.4816 if it matters, though
4.2.0 and 4.2.6 behave the same.

thanks,
Greg



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