public int bytesRead = -1;
-// Not technically a 2.0 only test, but I use lambdas, so I need gmcs
-
[Test]
[NUnit.Framework.Category ("MobileNotWorking")]
// This was for bug #459450
p.StartInfo.RedirectStandardError = true;
var exitedCalledCounter = 0;
+ var exited = new ManualResetEventSlim ();
p.Exited += (object sender, EventArgs e) => {
exitedCalledCounter++;
Assert.IsTrue (p.HasExited);
+ exited.Set ();
};
p.EnableRaisingEvents = true;
p.BeginOutputReadLine ();
p.WaitForExit ();
+ exited.Wait (10000);
Assert.AreEqual (1, exitedCalledCounter);
Thread.Sleep (50);
Assert.AreEqual (1, exitedCalledCounter);
p.EnableRaisingEvents = true;
var exitedCalledCounter = 0;
+ var exited = new ManualResetEventSlim ();
p.Exited += (object sender, EventArgs e) => {
exitedCalledCounter++;
Assert.IsTrue (p.HasExited);
+ exited.Set ();
};
p.Start ();
p.BeginOutputReadLine ();
p.WaitForExit ();
+ exited.Wait (10000);
Assert.AreEqual (1, exitedCalledCounter);
Thread.Sleep (50);
Assert.AreEqual (1, exitedCalledCounter);
}
- private ProcessStartInfo GetCrossPlatformStartInfo ()
+ ProcessStartInfo GetCrossPlatformStartInfo ()
{
- return RunningOnUnix ? new ProcessStartInfo ("/bin/ls", "/") : new ProcessStartInfo ("help", "");
+ if (RunningOnUnix) {
+ string path;
+#if MONODROID
+ path = "/system/bin/ls";
+#else
+ path = "/bin/ls";
+#endif
+ return new ProcessStartInfo (path, "/");
+ } else
+ return new ProcessStartInfo ("help", "");
}
[Test]
}
[Test]
+ [NUnit.Framework.Category ("MobileNotWorking")]
public void DisposeWithDisposedStreams ()
{
var psi = GetCrossPlatformStartInfo ();
p.Dispose ();
}
+ [Test]
+ [NUnit.Framework.Category ("MobileNotWorking")]
+ public void StandardInputWrite ()
+ {
+ var psi = GetCrossPlatformStartInfo ();
+ psi.RedirectStandardInput = true;
+ psi.RedirectStandardOutput = true;
+ psi.UseShellExecute = false;
+
+ using (var p = Process.Start (psi)) {
+ for (int i = 0; i < 1024 * 9; ++i)
+ p.StandardInput.Write ('x');
+ }
+ }
+
[Test]
public void Modules () {
var modules = Process.GetCurrentProcess ().Modules;