bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: process substitution error handling


From: Greg Wooledge
Subject: Re: process substitution error handling
Date: Thu, 6 Aug 2020 08:24:18 -0400
User-agent: Mutt/1.10.1 (2018-07-13)

On Thu, Aug 06, 2020 at 02:14:07PM +0200, Jason A. Donenfeld wrote:
> On Thu, Aug 6, 2020 at 1:15 PM Oğuz <oguzismailuysal@gmail.com> wrote:
> >     set -e o substfail
> >     : <(sleep 10; exit 1)
> >     foo
> >
> > Say that `foo' is a command that takes longer than ten seconds to complete, 
> > how would you expect the shell to behave here? Should it interrupt `foo' or 
> > wait for its termination and exit then? Or do something else?
> 
> It's likely simpler to check after foo, since bash can just ask "are
> any of the process substitution processes that I was wait(2)ing on in
> exited state with non zero return?", which just involves looking in a
> little list titled exited_with_error_process_subst for being non-null.

So, in a script like this:

set -e -o failevenharder
: <(sleep 1; false)
cmd1
cmd2
cmd3
cmd4

They're asking that the script abort at some unpredictable point during
the sequence of commands cmd1, cmd2, cmd3, cmd4 whenever the process
substitution happens to terminate?

I'm almost tempted to get behind that just to help the set -e users
reach the point of terminal absurdity even faster.  The wreckage should
be hilarious.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]