On 27.01.2012 12:54, Weeble wrote:
I have a program that uses
System.IO.Pipes.AnonymousPipe{Server,Client}Stream on .NET to
communicate between a parent and child process while still allowing
the child process to use stdin, stdout and stderr normally. I've found
that this part of System.IO.Pipes isn't implemented in Mono. From what
I can tell, it shouldn't be especially hard to implement these classes
themselves, but the critical problem would be that Process.Start
explicitly closes all open file descriptors (except for stdin, stdout
and stderr). The relevant code is here, in CreateProcess in
processes.c:

https://github.com/mono/mono/blob/master/mono/io-layer/processes.c#L988

Because of that, I believe any working implementation of
System.IO.Pipes.Anonymous* would require changes to CreateProcess.
Either:

1. Remove entirely the loop that closes file descriptors.

This is out of question. For example, you don't want to share sockets.

2. Maintain a process-wide table of all file descriptors associated
with the client-end of an AnonymousPipeServerStream, pass it into
CreateProcess and skip closing of those file descriptors.

This is the way to go. The Win32 pipe functions must be simulated
by the io-layer similarly to the other I/O functions. This way
you'd know which handles to duplicate/inherit.

Robert

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to