I see a couple of problems here. First, you should probably redirect not only
stdout
but also
stderr
using
System.Diagnostics.Process.StandardError
. Those multiplatform tool always make it difficult to see it if you redirect the output from console using pipe, but
Process
makes it right.
Also, I don't see any code where you actually capture
StandardInput
or
StandardError
.
Look at this code sample:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.standardoutput.aspx[
^].
As you're using
BeginOutputReadLine
, use this code sample:
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.beginoutputreadline.aspx[
^].
I don't think you really need asynchronous read operations though. It's much more straightforward to use a separate thread for creation process and waiting for its end. I think asynchronous operations were only good before threads were introduced. If you use my advice and use thread (which I highly recommend), you can use the pattern shown in a first code sample. In this thread, you can safely use the blocking call to
System.Diagnostics.Process.WaitForExit()
.
See also
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[
^].
—SA