2007-11-02 Robert Jordan <robertj@gmx.net>
[mono.git] / mcs / class / System / Test / System.Diagnostics / ProcessTest.cs
index f4c28f0e428da356909c3b6d69873ab1627d8748..a729bf5bcbd46baf7b3d1c6164f200266ca080fa 100644 (file)
@@ -76,14 +76,17 @@ namespace MonoTests.System.Diagnostics
                        Assert.IsTrue ((DateTime.Now - start).TotalMilliseconds < 1000, "#01 BeginRead was not async");
                        p.WaitForExit ();
                        Assert.AreEqual (0, p.ExitCode, "#02 script failure");
-
-                       Assert.AreEqual ("hello", Encoding.Default.GetString (buffer, 0, 5), "#03");
+                       if (bytesRead < "hello".Length)
+                               Assert.Fail ("#03 got {0} bytes", bytesRead);
+                       Assert.AreEqual ("hello", Encoding.Default.GetString (buffer, 0, 5), "#04");
                }
 
                void Read (IAsyncResult ar)
                {
                        Stream stm = (Stream) ar.AsyncState;
-                       stm.EndRead (ar);
+                       bytesRead = stm.EndRead (ar);
                }
+
+               int bytesRead = Int32.MinValue;
        }
 }