summaryrefslogtreecommitdiff
path: root/mcs/class/System/System.Diagnostics/Process.cs
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/System/System.Diagnostics/Process.cs')
-rw-r--r--mcs/class/System/System.Diagnostics/Process.cs39
1 files changed, 18 insertions, 21 deletions
diff --git a/mcs/class/System/System.Diagnostics/Process.cs b/mcs/class/System/System.Diagnostics/Process.cs
index e08d79e0f1..7a63ce0377 100644
--- a/mcs/class/System/System.Diagnostics/Process.cs
+++ b/mcs/class/System/System.Diagnostics/Process.cs
@@ -918,8 +918,7 @@ namespace System.Diagnostics {
IntPtr stderr,
ref ProcInfo proc_info);
- private static bool Start_shell (ProcessStartInfo startInfo,
- Process process)
+ private static bool Start_shell (ProcessStartInfo startInfo, Process process)
{
ProcInfo proc_info=new ProcInfo();
bool ret;
@@ -948,9 +947,7 @@ namespace System.Diagnostics {
process.process_handle = proc_info.process_handle;
process.pid = proc_info.pid;
-
process.StartExitCallbackIfNeeded ();
-
return(ret);
}
@@ -1182,9 +1179,9 @@ namespace System.Diagnostics {
if (startInfo == null)
throw new ArgumentNullException ("startInfo");
- Process process=new Process();
+ Process process = new Process();
process.StartInfo = startInfo;
- if (Start_common(startInfo, process))
+ if (Start_common(startInfo, process) && process.process_handle != IntPtr.Zero)
return process;
return null;
}
@@ -1566,6 +1563,21 @@ namespace System.Diagnostics {
async_output.Close ();
if (async_error != null)
async_error.Close ();
+
+ if (input_stream != null) {
+ input_stream.Close();
+ input_stream = null;
+ }
+
+ if (output_stream != null) {
+ output_stream.Close();
+ output_stream = null;
+ }
+
+ if (error_stream != null) {
+ error_stream.Close();
+ error_stream = null;
+ }
}
}
@@ -1576,21 +1588,6 @@ namespace System.Diagnostics {
Process_free_internal(process_handle);
process_handle=IntPtr.Zero;
}
-
- if (input_stream != null) {
- input_stream.Close();
- input_stream = null;
- }
-
- if (output_stream != null) {
- output_stream.Close();
- output_stream = null;
- }
-
- if (error_stream != null) {
- error_stream.Close();
- error_stream = null;
- }
}
}
base.Dispose (disposing);