[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 'wait' in command group in pipeline fails to recognize child process
From: |
Chet Ramey |
Subject: |
Re: 'wait' in command group in pipeline fails to recognize child process |
Date: |
Tue, 22 Jun 2021 09:15:23 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
On 6/22/21 5:42 AM, Martin Jambon wrote:
Hello!
I ran into something that looks like a bug to me, although I'm not super
familiar curly-brace command groups.
It's not the brace command; it's the pipeline.
Minimal repro:
$ sleep 1 & { wait $!; } | cat
[1] 665454
bash: wait: pid 665454 is not a child of this shell
I was expecting a success, just like we get without the pipeline:
The pipeline does, in fact, make the difference. Each process in a pipeline
is run in a subshell, and that subshell isn't the parent of the previously-
created asynchronous job. You can't wait for a process that isn't one of
your children.
--
``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/
- Re: 'wait' in command group in pipeline fails to recognize child process, (continued)
- Re: 'wait' in command group in pipeline fails to recognize child process, Lawrence Velázquez, 2021/06/22
- Re: 'wait' in command group in pipeline fails to recognize child process, Martin Jambon, 2021/06/22
- Re: 'wait' in command group in pipeline fails to recognize child process, Lawrence Velázquez, 2021/06/22
- Re: 'wait' in command group in pipeline fails to recognize child process, Martin Jambon, 2021/06/22
- Re: 'wait' in command group in pipeline fails to recognize child process, Greg Wooledge, 2021/06/22
- Re: 'wait' in command group in pipeline fails to recognize child process, Chet Ramey, 2021/06/23
- Re: 'wait' in command group in pipeline fails to recognize child process, Martin Jambon, 2021/06/23
- Re: 'wait' in command group in pipeline fails to recognize child process, Greg Wooledge, 2021/06/23
- Re: 'wait' in command group in pipeline fails to recognize child process, Chet Ramey, 2021/06/24
- Re: 'wait' in command group in pipeline fails to recognize child process, Chet Ramey, 2021/06/23
Re: 'wait' in command group in pipeline fails to recognize child process,
Chet Ramey <=