[Mono-list] System.Diagnostic.Process and event handlers

noda www.bgr at free.fr
Sat Jan 29 07:28:28 EST 2011


Hi,

I'm trying to port my .net console application on mono, and I'm experiencing
strange problems with external Process running with event handlers.

Here is what I'm doing:
- creating a new System.Diagnostic.Process, to run mencoder with some
specific parameters

- redirecting standard output from this process :
proc.ErrorDataReceived += new
System.Diagnostics.DataReceivedEventHandler(proc_DataReceived);
                proc.OutputDataReceived += new
System.Diagnostics.DataReceivedEventHandler(proc_DataReceived);

- in my proc_DataReceived method, i'm doing some processing to get info and
progress about encoding, and print a new progress info string in the
console.

I'm not creating any threads to do that, as I expect the process to run on
its own, and I just need to process its output via the event handlers.

My program runs perfectly fine on windows, but on OSX using mono, once the
process has started, I received 1 update from the event handler then all the
others after the process has finished. And sometimes, the application get
stuck indefinitely (probably some deadlock between the process and event
handlers?). I'm trying to use the debugger to track the problem, without
success.

If someone has a hint for resolving this problem, I would be more than
grateful.

Thanks by advance.

noda
-- 
View this message in context: http://mono.1490590.n4.nabble.com/System-Diagnostic-Process-and-event-handlers-tp3246096p3246096.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list