How do I compose pipes?
Ali Çehreli
acehreli at yahoo.com
Fri Jan 29 03:49:38 UTC 2021
On 1/28/21 3:45 PM, Anthony wrote:
> void end(AccumulatorPipe acc) {
> auto pids = acc.pids ~ P.spawnShell("cat", acc.stdout);
>
> foreach (pid; pids) {
> P.wait(pid);
> }
> }
> ```
>
>
> So now I can do something like:
> ```
> run("find source -name '*.d'")
> .pipe("entr ./make.d tests")
> .end(),
Cool but there should be one improvement because I don't think end() is
guaranteed to be executed in that code, which may leave zombie processes
around. From 'man waitpid':
"A child that terminates, but has not been waited for becomes a "zombie".
Which is relayed to std.process documentation as "to avoid child
processes becoming "zombies"".
Ali
More information about the Digitalmars-d-learn
mailing list