2009-10-12 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Mon, 12 Oct 2009 21:28:49 +0000 (21:28 -0000)
committerZoltan Varga <vargaz@gmail.com>
Mon, 12 Oct 2009 21:28:49 +0000 (21:28 -0000)
* Process.cs (Dispose): Close the async output/error readers. Fixes #545429.

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

mcs/class/System/System.Diagnostics/ChangeLog
mcs/class/System/System.Diagnostics/Process.cs

index b4f7b8ee04d45651fcd1a837314813cad8836495..bf79f1523d0a77d9413975a9f1a60c8923f156be 100644 (file)
@@ -1,3 +1,7 @@
+2009-10-12  Zoltan Varga  <vargaz@gmail.com>
+
+       * Process.cs (Dispose): Close the async output/error readers. Fixes #545429.
+
 2009-07-22  Jb Evain  <jbevain@novell.com>
 
        * ProcessStartInfo.cs: force no-verb on MONOTOUCH.
index 5db07962592ed87b98f65feac662043eb6f96ef8..9fe5d909b6f3dfefc1e14a6a309c7ece22084398 100644 (file)
@@ -1385,7 +1385,7 @@ namespace System.Diagnostics {
                        internal int error;
                        public int operation = 8; // MAGIC NUMBER: see Socket.cs:AsyncOperation
                        public object ares;
-
+                       public int EndCalled;
 
                        // These fields are not in SocketAsyncResult
                        Process process;
@@ -1484,6 +1484,10 @@ namespace System.Diagnostics {
                                        }
                                }
                        }
+
+                       public void Close () {
+                               stream.Close ();
+                       }
                }
 
                AsyncModes async_mode;
@@ -1589,6 +1593,13 @@ namespace System.Diagnostics {
                                // dispose all managed resources.
                                if(disposing) {
                                        // Do stuff here
+                                       lock (this) {
+                                               /* These have open FileStreams on the pipes we are about to close */
+                                               if (async_output != null)
+                                                       async_output.Close ();
+                                               if (async_error != null)
+                                                       async_error.Close ();
+                                       }
                                }
                                
                                // Release unmanaged resources