[Mono-list] Re: Process doesn't give back the hand on Windows

Robert Jordan robertj@gmx.net
Tue, 10 May 2005 02:21:11 +0200


Vincent,

> 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 ?

I bet the problem is not related to Mono. It's the braindead rsh.exe.
You may try to use its "-n" switch, like here:

proc.StartInfo.Arguments = "machine -l mylogin -n \"./myscript\"";	

Rob