piping processes

Steven Schveighoffer schveiguy at yahoo.com
Thu Dec 1 05:24:25 PST 2011


On Thu, 01 Dec 2011 06:10:00 -0500, Regan Heath <regan at netmail.co.nz>  
wrote:

> On Wed, 30 Nov 2011 23:35:58 -0000, NMS <nathanmswan at gmail.com> wrote:
>
>> Is there a cross-platform way to create a new process and get its i/o  
>> streams? Like java.lang.Process?
>
> No.  It different on windows and unix platforms, tho most/many of the  
> unix platforms are similar.
>
> std.process is rather limited in it's current incarnation but I think  
> Steve is working on a bit update..

It's ready for review, but I'm waiting on myself to get a pull request in  
for dmc...

Going to kick myself to do it now.

>   - Pro tip; you now want to call DuplicateHandle on the parent handle  
> for each pipe to remove 'inheritance' - this stops the child process  
> inheriting the handle (which would result in 2 open handles to the pipe,  
> and closure of the parent handle would not be detected by the child).   
> After duplication you close the original parent side inheritable handles.

There's also SetHandleInformation (which I forgot to do in my  
implementation, thanks for bringing this up)

http://msdn.microsoft.com/en-us/library/windows/desktop/ms724935(v=vs.85).aspx

-Steve


More information about the Digitalmars-d-learn mailing list