[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Waiting for a sub-process to finish
From: |
Russell Lewis |
Subject: |
Re: [Help-bash] Waiting for a sub-process to finish |
Date: |
Fri, 2 Jun 2017 07:46:06 -0700 |
Indeed, "| cat" is subtle. But it works so well, I use it - just with lots
of comments to explain it, every time. :)
Russ
On Jun 1, 2017 6:09 PM, "Bob Proulx" <address@hidden> wrote:
> João Eiras wrote:
> > long_command -o >(gzip -c > file.gz)
> > if gzip -dc file.gz | grep -q bad_line; then
> ...
> > This happens because the subprocess ">(gzip -c > file.gz)" has not had
> time
> > to finish and close the output file.
> ...
> > Question: How can I force bash to wait until all subprocesses to finish ?
>
> I complained about this exact same problem back in 2007. And
> apparently I was the first complaint about it. :-}
>
> https://lists.gnu.org/archive/html/bug-bash/2007-09/msg00019.html
>
> Some years later I learned the trick of "| cat" to use closure of the
> file handles to join these asynchronous processes up. But I still
> avoid it because I think it would be confusing to later programmers
> reading the code.
>
> I still think this is surprising behavior and something that the bash
> should wait for automatically.
>
> Bob
>
>
Message not available
Re: [Help-bash] Waiting for a sub-process to finish, Bob Proulx, 2017/06/01
- Re: [Help-bash] Waiting for a sub-process to finish,
Russell Lewis <=