Re: Examples of concurrent coproc usage?

2024-04-16 Thread Andreas Schwab
On Apr 16 2024, Carl Edquist wrote: > Well, you _can_ shovel binary data too: (*) > > while IFS= read -rd '' X; do printf '%s\0' "$X"; done > > and use that pattern to make a shell-only version of tee(1) (and I suppose > paste(1)). Binary data doesn't work if you're reading newline-terminat

Re: Examples of concurrent coproc usage?

2024-04-16 Thread Zachary Santer
On Tue, Apr 16, 2024 at 3:56 AM Andreas Schwab wrote: > > On Apr 16 2024, Carl Edquist wrote: > > > Well, you _can_ shovel binary data too: (*) > > > > while IFS= read -rd '' X; do printf '%s\0' "$X"; done > > > > and use that pattern to make a shell-only version of tee(1) (and I suppose > >

Re: Examples of concurrent coproc usage?

2024-04-16 Thread Carl Edquist
On Tue, 16 Apr 2024, Andreas Schwab wrote: But you can delimit your records on NULs, and use printf to reproduce them. Though that will likely add a spurious null at EOF. On Tue, 16 Apr 2024, Zachary Santer wrote: Just wouldn't copy over whatever might have followed the final null byte, i

Re: Examples of concurrent coproc usage?

2024-04-16 Thread Chet Ramey
On 4/12/24 12:49 PM, Carl Edquist wrote: Where with a coproc coproc X { potentially short lived command with output; } exec {xr}<&${X[0]} {xw}>&${X[1]} there is technically the possibility that the coproc can finish and be reaped before the exec command gets a chance to run and dupl