Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2004-02-22 08:24:27 +0300
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2004-02-22 08:24:27 +0300
commitfd2f751c176e849c21cbe75ec8da11f3c089c773 (patch)
tree6a521fdb74c643d559ec65a570a8e8e859f10754 /mcs/class/System/System.Diagnostics
parentf12a1a927fd8a8c0b24e01248ad124cd590b670f (diff)
2004-02-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Process.cs: ExitCode and ExitTime check that the process is finished. svn path=/trunk/mcs/; revision=23316
Diffstat (limited to 'mcs/class/System/System.Diagnostics')
-rw-r--r--mcs/class/System/System.Diagnostics/ChangeLog4
-rwxr-xr-xmcs/class/System/System.Diagnostics/Process.cs19
2 files changed, 21 insertions, 2 deletions
diff --git a/mcs/class/System/System.Diagnostics/ChangeLog b/mcs/class/System/System.Diagnostics/ChangeLog
index 787481f314d..24fc6347228 100644
--- a/mcs/class/System/System.Diagnostics/ChangeLog
+++ b/mcs/class/System/System.Diagnostics/ChangeLog
@@ -1,3 +1,7 @@
+2004-02-22 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * Process.cs: ExitCode and ExitTime check that the process is finished.
+
2003-12-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Process.cs: if there's an error when starting the process, the 'pid'
diff --git a/mcs/class/System/System.Diagnostics/Process.cs b/mcs/class/System/System.Diagnostics/Process.cs
index 1de6f0f4b17..313b88d78db 100755
--- a/mcs/class/System/System.Diagnostics/Process.cs
+++ b/mcs/class/System/System.Diagnostics/Process.cs
@@ -71,7 +71,15 @@ namespace System.Diagnostics {
[MonitoringDescription ("The exit code of the process.")]
public int ExitCode {
get {
- return(ExitCode_internal(process_handle));
+ if (process_handle == IntPtr.Zero)
+ throw new InvalidOperationException ("Process has not been started.");
+
+ int code = ExitCode_internal (process_handle);
+ if (code == 259)
+ throw new InvalidOperationException ("The process must exit before " +
+ "getting the requested information.");
+
+ return code;
}
}
@@ -85,6 +93,13 @@ namespace System.Diagnostics {
[MonitoringDescription ("The exit time of the process.")]
public DateTime ExitTime {
get {
+ if (process_handle == IntPtr.Zero)
+ throw new InvalidOperationException ("Process has not been started.");
+
+ if (!HasExited)
+ throw new InvalidOperationException ("The process must exit before " +
+ "getting the requested information.");
+
return(DateTime.FromFileTime(ExitTime_internal(process_handle)));
}
}
@@ -110,7 +125,7 @@ namespace System.Diagnostics {
[MonitoringDescription ("Determines if the process is still running.")]
public bool HasExited {
get {
- int exitcode=ExitCode;
+ int exitcode = ExitCode_internal (process_handle);
if(exitcode==259) {
/* STILL_ACTIVE */