[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Examples of concurrent coproc usage?
From: |
Zachary Santer |
Subject: |
Re: Examples of concurrent coproc usage? |
Date: |
Wed, 3 Apr 2024 13:19:27 -0400 |
On Wed, Apr 3, 2024 at 10:32 AM Chet Ramey <chet.ramey@case.edu> wrote:
>
> How long should the shell defer deallocating the coproc after the process
> terminates? What should it do to make sure that the variables don't hang
> around with invalid file descriptors? Or should the user be responsible for
> unsetting the array variable too? (That's never been a requirement,
> obviously.)
For sake of comparison, and because I don't know the answer, what does
bash do behind the scenes in this situation?
exec {fd}< <( some command )
while IFS='' read -r line <&"${fd}"; do
# do stuff
done
{fd}<&-
Because the command in the process substitution isn't waiting for
input, (I think) it could've exited at any point before all of its
output has been consumed. Even so, bash appears to handle this
seamlessly.
As the programmer, I know ${fd} contains an fd that's no longer valid
after this point, despite it not being unset.
- Re: Examples of concurrent coproc usage?, Chet Ramey, 2024/04/01
- Re: Examples of concurrent coproc usage?, Chet Ramey, 2024/04/03
- Re: Examples of concurrent coproc usage?,
Zachary Santer <=
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Re: Examples of concurrent coproc usage?, Zachary Santer, 2024/04/15
- Re: Examples of concurrent coproc usage?, Carl Edquist, 2024/04/16
- Re: Examples of concurrent coproc usage?, Andreas Schwab, 2024/04/16
- Re: Examples of concurrent coproc usage?, Zachary Santer, 2024/04/16
- Re: Examples of concurrent coproc usage?, Carl Edquist, 2024/04/16
- Re: Examples of concurrent coproc usage?, Chet Ramey, 2024/04/17