2007-11-02 Robert Jordan <robertj@gmx.net>
authorRobert Jordan <robertj@gmx.net>
Fri, 2 Nov 2007 01:42:43 +0000 (01:42 -0000)
committerRobert Jordan <robertj@gmx.net>
Fri, 2 Nov 2007 01:42:43 +0000 (01:42 -0000)
* ProcessTest.cs (TestRedirectedOutputIsAsync):
Wait for the pending async operation.

svn path=/trunk/mcs/; revision=88707

mcs/class/System/Test/System.Diagnostics/ChangeLog
mcs/class/System/Test/System.Diagnostics/ProcessTest.cs

index 2ad2b7756a03f0fcdfb170425b4fe0326af36752..a129eab9e6add51c938c669486958dc897e33689 100644 (file)
@@ -1,3 +1,8 @@
+2007-11-02  Robert Jordan  <robertj@gmx.net>
+
+       * ProcessTest.cs (TestRedirectedOutputIsAsync):
+       Wait for the pending async operation.
+
 2007-11-02  Robert Jordan  <robertj@gmx.net>
 
        * ProcessTest.cs (TestRedirectedOutputIsAsync):
index a729bf5bcbd46baf7b3d1c6164f200266ca080fa..d315f0a19b42b4ebbb2adc26f043d5bd17875c58 100644 (file)
@@ -70,12 +70,13 @@ namespace MonoTests.System.Diagnostics
 
                        // start async Read operation
                        DateTime start = DateTime.Now;
-                       stdout.BeginRead (buffer, 0, buffer.Length,
-                                         new AsyncCallback (Read), stdout);
+                       IAsyncResult ar = stdout.BeginRead (buffer, 0, buffer.Length,
+                                                           new AsyncCallback (Read), stdout);
 
                        Assert.IsTrue ((DateTime.Now - start).TotalMilliseconds < 1000, "#01 BeginRead was not async");
                        p.WaitForExit ();
                        Assert.AreEqual (0, p.ExitCode, "#02 script failure");
+                       ar.AsyncWaitHandle.WaitOne (2000, false);
                        if (bytesRead < "hello".Length)
                                Assert.Fail ("#03 got {0} bytes", bytesRead);
                        Assert.AreEqual ("hello", Encoding.Default.GetString (buffer, 0, 5), "#04");
@@ -87,6 +88,6 @@ namespace MonoTests.System.Diagnostics
                        bytesRead = stm.EndRead (ar);
                }
 
-               int bytesRead = Int32.MinValue;
+               int bytesRead = -1;
        }
 }