Write to stdin, read from stdout of a spawn command (a library)

Victor Porton porton at narod.ru
Wed Jan 23 23:23:47 UTC 2019


On Wednesday, 23 January 2019 at 22:51:45 UTC, Victor Porton 
wrote:
> I want to write to stdin and read from stdout of an OS command 
> I spawn without deadlocks. (I have a string to write to stdin 
> and want to read its stdout as a string.)
>
> Is there a ready D library for this?
>
> I wrote a C library for this and consider to port to D (either 
> as bindings or as a rewrite):
>
> https://github.com/vporton/libcomcom

By the way, is it worth to rewrite this using fibers?

Fibers have the advantage that it becomes possible to run several 
spawn commands simultaneously. However, I suspect that usage of 
fibers may make the code even less efficient than the current 
approach which passes input and output as one string write/read 
operation, without any split of data into several I/O operations.

What do you think?


More information about the Digitalmars-d mailing list