How to get output of piped process?
kdevel
kdevel at vogtner.de
Thu Feb 25 15:28:25 UTC 2021
On Monday, 22 February 2021 at 13:23:40 UTC, Danny Arends wrote:
> On Friday, 19 February 2021 at 15:39:25 UTC, kdevel wrote:
[...]
>> Fortunately the D runtime /does/ take care and it throws---if
>> the signal
>> is ignored beforehand. I filed issue 21649.
[...]
> Perhaps a bit late,
It's never too late.™ :-)
> but this is how I deal with pipes and spawnShell.
> Read one byte at a time from stdout and stderr:
>
> https://github.com/DannyArends/DaNode/blob/master/danode/process.d
Is this immune to SIGPIPE and is this design able to serve
infinite
streams? BTW: Why does run use spawnShell and not spawnProcess
(would
save one File object).
If the design is not intended to serve infinite streams I would
suggest to open two temporary files "out" and "err", delete them,
and let the child process write stdout/stderr into those files.
IFAICS this avoid threads, sleep, pipe and reading with fgetc.
More information about the Digitalmars-d-learn
mailing list