Re: bash loses control of jobs inside a command substitution

2019-11-22 Thread Chet Ramey
On 11/20/19 9:54 AM, Robert Elz wrote: Date:Tue, 19 Nov 2019 16:51:12 -0300 From:Luiz Angelo Daros de Luca Message-ID: | And two related features requests: 1) It seems that pids args are ignored | by wait when '-n' is specified. However, it would be a nic

Re: bash loses control of jobs inside a command substitution

2019-11-20 Thread Chet Ramey
On 11/19/19 2:51 PM, Luiz Angelo Daros de Luca wrote: Hello, Normally 'wait -n' will return the exit code of background process when they terminate before wait is runned. However, when bg processes and 'wait -n' runs inside a command substitution, bash loses control of bg process as soon as they

Re: bash loses control of jobs inside a command substitution

2019-11-20 Thread Robert Elz
Date:Tue, 19 Nov 2019 16:51:12 -0300 From:Luiz Angelo Daros de Luca Message-ID: | And two related features requests: 1) It seems that pids args are ignored | by wait when '-n' is specified. However, it would be a nice add_on to use | the list of pids as a filt

Re: bash loses control of jobs inside a command substitution

2019-11-20 Thread Oğuz
Behavior of wait -n differs on interactive and non-interactive sessions though, maybe this really is a bug $ bash -ic '( ( sleep 0.1; exit 13 ) & sleep 0; wait -n; echo $? )' 0 $ bash -c '( ( sleep 0.1; exit 13 ) & sleep 0; wait -n; echo $? )' 13 On Wed, Nov 20, 2019 at 1:01 PM Oğ

Re: bash loses control of jobs inside a command substitution

2019-11-20 Thread Oğuz
This seems more like a race condition, see: $ f() { ( sleep 0.1; exit 13 ) & "$@"; wait -n; echo $?; } $ $ f sleep 0.0 [1] 30612 [1]+ Exit 13 ( sleep 0.1; exit 13 ) 13 $ f sleep 0.2 [1] 30617 [1]+ Exit 13 ( sleep 0.1; exit 13 )