[Mono-devel-list] Capturing Shell Output: System.Diagnostics.Process

Ben Hill ben at serosoft.com
Wed Feb 2 09:10:11 EST 2005


I'm using the code:

Process proc = new Process();
proc.EnableRaisingEvents=false;
proc.StartInfo.FileName= "command";
proc.StartInfo.Arguments = "--args";
proc.Start();
proc.WaitForExit();

...to execute a shell command. I can get the proc.ExitCode to get the
status of the execution, but I'd like to be able to capture the std out
messages too, and the error messages from this command. Is there a way
of doing this? I've Googled for a bit, but not found much.

Cheers,

Ben

-- 
ben at serosoft.com - www.seigan.org
GPG Fingerprint: 4309 1C58 5143 AFAC F69E  11CD 76FD 56D4 1223 E387






More information about the Mono-devel-list mailing list