Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16718
| From | Chet Ramey <chet.ramey@case.edu> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: process substitution error handling |
| Date | 2020-08-06 11:14 -0400 |
| Organization | ITS, Case Western Reserve University |
| Message-ID | <mailman.1027.1596726900.2739.bug-bash@gnu.org> (permalink) |
| References | (2 earlier) <CAHmME9pzOY_0EJ69y9wt6r-Jh3frZpV8XdFC6zG5EOkZ99h-1A@mail.gmail.com> <ac79e09f-b4e3-5368-87c1-b6e7147809e2@case.edu> <CAHmME9qNjO+LMxB8py2MDpS2Oprv1mRndgfTXQfXNWyHuwzmjg@mail.gmail.com> <9b358a76-4867-41b9-5a3a-c1892c76b8ee@case.edu> <d27db25d-e533-3fa8-b85e-6dfbe6adefb3@case.edu> |
On 8/6/20 10:48 AM, Chet Ramey wrote: >> Perhaps another, clunkier, proposal would be to add `wait -s` so that >> the wait builtin also waits for process substitutions and returns >> their exit codes and changes $?. The downside would be that scripts >> now need to add a "wait" after all of above such loops, but on the >> upside, it's better than the current problematic situation. > > You can already do this. Since process substitution sets $!, you can > keep track of all of the process substitutions of interest and wait > for as many of them as you like. `wait' will return their statuses > and set $? for you. I should have also mentioned that while bash-5.0 requires you to wait for these process substitutions one at a time, in between their creation, bash-5.1 will allow you to save $! and wait for them later: $ cat x2 : <(sleep 5; exit 1) P1=$! : <(sleep 5; exit 2) P2=$! : <(sleep 5; exit 3) P3=$! wait $P1 ; echo $? wait $P2 ; echo $? wait $P3 ; echo $? $ ../bash-5.1-alpha/bash x2 1 2 3 -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
Back to gnu.bash.bug | Previous | Next | Find similar
Re: process substitution error handling Chet Ramey <chet.ramey@case.edu> - 2020-08-06 11:14 -0400
csiph-web