diff --git a/mcs/class/System/Test/System.Diagnostics/ProcessTest.cs b/mcs/class/System/Test/System.Diagnostics/ProcessTest.cs index f53d254c84417..75c4614ad2a43 100644 --- a/mcs/class/System/Test/System.Diagnostics/ProcessTest.cs +++ b/mcs/class/System/Test/System.Diagnostics/ProcessTest.cs @@ -881,6 +881,20 @@ ProcessStartInfo GetCrossPlatformStartInfo () } else return new ProcessStartInfo ("help", ""); } + + ProcessStartInfo GetEchoCrossPlatformStartInfo () + { + if (RunningOnUnix) { + string path; +#if MONODROID + path = "/system/bin/cat"; +#else + path = "/bin/cat"; +#endif + return new ProcessStartInfo (path); + } else + return new ProcessStartInfo ("type"); + } #endif // MONO_FEATURE_PROCESS_START [Test] @@ -972,14 +986,25 @@ public void DisposeWithDisposedStreams () [NUnit.Framework.Category ("MobileNotWorking")] public void StandardInputWrite () { - var psi = GetCrossPlatformStartInfo (); + var psi = GetEchoCrossPlatformStartInfo (); psi.RedirectStandardInput = true; psi.RedirectStandardOutput = true; psi.UseShellExecute = false; using (var p = Process.Start (psi)) { - for (int i = 0; i < 1024 * 9; ++i) + // drain stdout + p.OutputDataReceived += (s, e) => {}; + p.BeginOutputReadLine (); + + for (int i = 0; i < 1024 * 9; ++i) { p.StandardInput.Write ('x'); + if (i > 0 && i % 128 == 0) + p.StandardInput.WriteLine (); + } + + p.StandardInput.Close (); + + p.WaitForExit (); } } #endif // MONO_FEATURE_PROCESS_START