[Ironpython-users] Failing to read the standard output
Jeff Hardy
jdhardy at gmail.com
Sun Apr 26 00:39:24 CEST 2015
On Thu, Apr 9, 2015 at 5:58 AM, Hemanth M B <hemanth at broadcom.com> wrote:
>
>
> Hi All,
>
>
>
> I am using System.Diagnostics namespace to spawn a console application. I
> want use asynchronous read and synchronous write, since the application is
> interactive. If I use synchronous read as mentioned below code, I need to
> close the stream writer before reading to end. Please help me to make code
> interactive.
Hi Hemanth,
This isn't really IronPython specific, so finding a similar solution
in C# you should be able to translate it fairly easily. In this case I
think you need to use the OutputDataReceived event and call
BeginOutputReadLine to start the process, then handle the output
events from the event handler.
Alternatively, call ReadLine in a separate thread so that it doesn't
block. This is a bit tricky to get right, so the event approach is
probably better depending on what you need to do with the output.
- Jeff
More information about the Ironpython-users
mailing list