bug-bash
[Top][All Lists]
Advanced

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

Re: How to deal with errors in <()?


From: Stephane Chazelas
Subject: Re: How to deal with errors in <()?
Date: Sun, 8 Mar 2015 22:05:29 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

2015-03-07 18:01:18 -0600, Eduardo A. Bustamante López:
> > But I am wondering if there is a walkaround to deal with errors in
> > <(). The ideal behavior should be that if there is a error in <(),
> > then we should not consider commandA is executed correctly even if its
> > return status is 0.
> Again, address your questions to help-bash.
[...]

Are bash questions no longer on topic here? bash-bug used to be
the place to discuss bash (before help-bash was created). It maps to the
gnu.bash.bug newsgroup. I don't think help-bash maps to usenet
(though you can access it over NNTP on gmane).

There's a alt.comp.lang.shell.unix.bourne-bash but it doesn't
look very lively.

What's the official line?

To get back on a bug topic though:

$ bash --norc
bash-4.3$ echo <(exit 123)
/dev/fd/63
bash-4.3$ echo "$!"
12142
bash-4.3$ wait "$!"
bash: wait: pid 12142 is not a child of this shell

Having the process substitution pid in $! is not very useful if
you can't wait for it to retrieve the status.

That also means it overrides the $! of a previous asynchronous
job.

That doesn't work well if there are more than one process
substitutions as in

diff <(cmd1) <(cmd2)

(you get the pid of cmd2 in $1 (well the shell process waiting
for cmd2))

That error message is also lying:

~$ bash --norc
bash-4.3$ : <(sleep 100)
bash-4.3$ wait $!
bash: wait: pid 12291 is not a child of this shell
bash-4.3$ ps -H
  PID TTY          TIME CMD
 4942 pts/9    00:00:00 zsh
12244 pts/9    00:00:00   bash
12291 pts/9    00:00:00     bash
12292 pts/9    00:00:00       sleep
12293 pts/9    00:00:00     ps

clearly 12291 still is a child of this shell.

(BTW, why not execute sleep in the same process like in command
substitution?)

-- 
Stephane



reply via email to

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