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

Re: No pipefail option?



On Oct 7, 10:25am, Peter Stephenson wrote:
}
} I haven't yet quite worked out why it's not possible to detect the point
} at which the job is finished and examine the state at that point, so I
} can't comment further, but I might look again and ask stupid questions.

I don't remember clearly all the details, but it's some combination of:

- because external jobs can exit and be reaped in arbitrary order, even
  in a pipeline, the job table is used to keep track of which position
  in the array to update

- jobs that run in the current shell don't have a complete job table entry
  [cf. all the gyrations to suspend/background a loop] and aren't "reaped"
  in the same code path as external jobs, so the wrong array position (or
  none at all) may get updated

- the incorrect update depends on whether the external job exited AND got
  reaped before the current-shell job has completed, because of the way
  reaping updates the job table, so correctness is unpredictable

- complex commands "in the current shell" may have external subjobs that
  need a separate pipestatus (this applies only at end of a pipeline)



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