Bidirectional PIPE, and do not wait for child to terminate

Justin Whear via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 1 14:12:46 PDT 2014


On Tue, 01 Jul 2014 21:00:58 +0000, Justin Whear wrote:

> On Tue, 01 Jul 2014 20:42:14 +0000, seany wrote:
> 
>> On Tuesday, 1 July 2014 at 15:32:31 UTC, Justin Whear wrote:
>> 
>> 
>>> A pipe can be unidirectional only, but you can use more than one.
>> 
>> and what about FIFO or LIFO s?
> 
> You can use the C mkfifo function (import core.sys.posix.sys.stat) to
> create new named pipes.
> 
> Once created you should be able to open a FIFO with `File("blah.ipc",
> "rw")` in both processes.  Because you aren't using the standard file
> descriptors, you can spawn the child process however you like.

Actually, if I recall correctly, trying to read and write a FIFO pipe 
from the same end is undefined behavior on Linux and illegal in Unix.  If 
you really want a single "pipe" with two-way traffic, use a domain socket.


More information about the Digitalmars-d-learn mailing list