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

Sander Rijken sr at d-90.nl
Wed Feb 2 17:41:27 EST 2005


That will probably not work I'm affraid. You'll need two monitor threads, 
one looking at StandardOutput and one looking at StandardError, to avoid 
blocking and possible deadlock.
(see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDiagnosticsProcessPropertiesTopic.asp)

Here's an example how it's done in monodevelop:
http://svn.myrealbox.com/monodevelop/trunk/MonoDevelop/Core/src/MonoDevelop.Base/Services/ProcessService/ProcessWrapper.cs


Greetz,
--

Sander Rijken <sr at d-90.nl>

On Wed, 2 Feb 2005, Ben Hill wrote:

> On Wed, 2005-02-02 at 14:49, Jörg Rosenkranz wrote:
>> proc.StartInfo.RedirectStandardOutput = true;
>> proc.StartInfo.RedirectStandardError = true;
>>
>> ...
>>
>> string stdOut = proc.StandardOutput.ReadToEnd();
>> string stdErr = proc.StandardError.ReadToEnd();
>>
>> HTH,
>> Joerg.
>
> Absolutely perfect, thanks! :-)
>
> -- 
> ben at serosoft.com - www.seigan.org
> GPG Fingerprint: 4309 1C58 5143 AFAC F69E  11CD 76FD 56D4 1223 E387
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>


More information about the Mono-devel-list mailing list