[Mono-list] Process doesn't give back the hand on Windows
Gonzalo Paniagua Javier
reply.to.the.list.iam.suscribed@notexists.ximian.com
Tue, 10 May 2005 19:52:31 -0600
On Mon, 2005-05-09 at 16:19 -0600, Gonzalo Paniagua Javier wrote:
> On Mon, 2005-05-09 at 18:32 +0200, Vincent Arnoux wrote:
> > Hello,
> > I am trying to make work a mono app under Windows and I am having a hard
> > time with an external process execution that doesn't give the hand back:
> > System.Diagnostics.Process proc = new System.Diagnostics.Process();
> > proc.StartInfo.FileName = "C:\\WINNT\\system32\\rsh.exe";
> > proc.StartInfo.Arguments = "machine -l mylogin \"./myscript\"";
> > proc.StartInfo.UseShellExecute = false;
> > proc.StartInfo.RedirectStandardOutput = true;
> > proc.Start();
> > proc.WaitForExit();
> > string output = proc.StandardOutput.ReadToEnd();
> > Console.WriteLine(output);
> > Console.WriteLine("End of script");
> >
> > I never can read the "End of script" line. What am I doing bad ?
>
> Is the process writing to stderr? If so, as you're only reading stdout,
> it may block when writing to StandardError.
duh. WaitForExit ought to be *after* ReadToEnd.