[Process] Set haveProcessHandle to true when setting m_processHandle
authorLudovic Henry <ludovic@xamarin.com>
Thu, 14 Apr 2016 09:53:13 +0000 (11:53 +0200)
committerLudovic Henry <ludovic@xamarin.com>
Thu, 14 Apr 2016 11:15:20 +0000 (13:15 +0200)
mcs/class/System/System.Diagnostics/Process.cs

index 41cf0d8c8c455930dfc4e5c8bbd84c9fa5308d74..6e929543aed5fec2f03a7c7dde270c307a54b91d 100644 (file)
@@ -74,7 +74,7 @@ namespace System.Diagnostics
 
                /* Private constructor called from other methods */
                private Process (SafeProcessHandle handle, int id) {
-                       m_processHandle = handle;
+                       SetProcessHandle (handle);
                        SetProcessId (id);
                }
 
@@ -606,13 +606,9 @@ namespace System.Diagnostics
                                throw new Win32Exception (-proc_info.pid);
                        }
 
-                       m_processHandle = new SafeProcessHandle (proc_info.process_handle, true);
-                       haveProcessHandle = true;
+                       SetProcessHandle (new SafeProcessHandle (proc_info.process_handle, true));
                        SetProcessId (proc_info.pid);
 
-                       if (watchForExit)
-                               EnsureWatchingForExit ();
-
                        return ret;
                }
 
@@ -771,8 +767,7 @@ namespace System.Diagnostics
                                }
                        }
 
-                       m_processHandle = new SafeProcessHandle (proc_info.process_handle, true);
-                       haveProcessHandle = true;
+                       SetProcessHandle (new SafeProcessHandle (proc_info.process_handle, true));
                        SetProcessId (proc_info.pid);
                        
                        if (startInfo.RedirectStandardInput) {
@@ -808,9 +803,6 @@ namespace System.Diagnostics
                                standardError = new StreamReader (new FileStream (stderr_read, FileAccess.Read, true, 8192), stderrEncoding, true);
                        }
 
-                       if (watchForExit)
-                               EnsureWatchingForExit ();
-
                        return true;
                }