2
Vote

Process StandardOutputObservable Extension

description

Add a StandardOutputObservable extension to the Process class.
 
Original discussion:
http://social.msdn.microsoft.com/Forums/en/rx/thread/49da113d-6d2a-4ce9-85c4-3acdbfa28f56

comments

AcousticGuitar wrote Apr 24, 2012 at 6:17 PM

We all will eventually use the Process class in our projects, this just turns StandardOutput and hopefully StandardError into observables.

I don't see a way or does it make sense to consider StandardInput.

davedev wrote Apr 24, 2012 at 8:42 PM

We could wrap StandardError as well via the ErrorDataReceived event; good idea.

http://msdn.microsoft.com/en-us/library/system.diagnostics.process.errordatareceived.aspx

However, there are no events that indicate when StandardInput has received data so that's just not possible. Though if you meant the other direction, writing to a stream doesn't need an observer wrapper. It's as easy as this:

lines.Subscribe(process.StandardInput.WriteLine);