Wrap Unmanaged Pipe Handle in a FileStream? RRS feed

  • Question

  • I'm probably beating a dead horse but I just can't let it go.   I created a new thread from ( since my problem is very specific now.

    So I PInvoke CreatePipe give the write handle to my child proc for stdout and wrap the other in SafeFileHandle (IsValid == true) and then create a FileStream with that.  Then I create a StreamReader.  Do this for stderr and stdin (reversed obviously).  The data from the child proc stdout looks good except I hang since EndOfStream never gets set to true.  Here's a couple of exceptions from the FileStream that explain why

    +  Length 'readerStdOut.BaseStream.Length' threw an exception of type 'System.NotSupportedException' long {System.NotSupportedException}
    +  Position 'readerStdOut.BaseStream.Position' threw an exception of type 'System.NotSupportedException' long {System.NotSupportedException}

    I know system.diagnostics.Process redirects stdout, stderr, stdin so I know it is possible.  Is there something else I should wrap the Pipe handle with besides a FileStream?  I don't see any other class that takes an OS handle.

    Someone just tell me to give up!



    Thursday, March 2, 2006 1:54 PM