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.
_______________________________________________
Mono-list maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list