Hi.
I'm new to this list so I'm not sure if I'm wrong here...
But calling
> export.StartInfo.RedirectStandardOutput = true;
> export.WaitForExit();
> export.StandardOutput.ReadToEnd()
can lead to a deadlock (at least when using .net framework...).
When export.StandardOutput buffer is full the called thread will wait for
the buffer to clear while the calling thread will wait for the called thread
to exit....

Yours,
Nils

2009/9/1 Fred Patterson <[email protected]>

>  Chris,
>
> I was able to fix it. You got me started down the right path.
> I still couldn't get the argument variable to work with the 1>output.log,
> however, I was able to work around it.
> The below code creates a file called output.log in the current path.
>
> Thanks again.
>
>
>                             System.Diagnostics.Process export = new
> System.Diagnostics.Process();
>                             export.EnableRaisingEvents = false;
>                             export.StartInfo.RedirectStandardOutput = true;
>                             export.StartInfo.RedirectStandardError = true;
>                             export.StartInfo.UseShellExecute = false;
>                             export.StartInfo.FileName = "/bin/sh";
>                             export.StartInfo.Arguments = "discover.sh";
>
>                             export.Start();
>
>                             export.WaitForExit();
>                             if (0 != export.ExitCode)
> Console.WriteLine("Error");
>
>                             TextWriter output = new
> StreamWriter("output.log");
>
> output.WriteLine(export.StandardOutput.ReadToEnd());
>                             output.Close();
>
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to