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

Re: Shell job structure



On Oct 25,  4:21pm, Peter Stephenson wrote:
}
} > % false | true | false | while true | false | true; do print $pipestatus; break; done; print $pipestatus
} > 0 1 0
} > 1 0 1 0
} 
} That's the sort of thing I'm worrying about.  As long as it can identify
} succesfully which job it needs to worry about at any time, it should be
} OK.

Every entry in $pipestatus except the very last one is copied from a
"Process" structure in the Job "procs" list, so as long as child reaping
updates the correct Process (which seems to be pretty solid or we'd have
scads of other problems) there's only that last slot to worry about.

The global "lastval" is used to populate that final slot when the command
is executing in the current shell.  That's a bit fragile and somewhat
backward because in all other cases the status that goes into pipestats
is also used to *assign* lastval -- it's just this "optimized" case where
we assume lastval has already been set correctly.

This is why update_job() has to skip PIPEFAIL handling and leave that to 
printjob(), so they don't use lastval in the wrong order.



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