diff options
author | Darin Wright | 2001-06-07 14:54:08 +0000 |
---|---|---|
committer | Darin Wright | 2001-06-07 14:54:08 +0000 |
commit | 81dbb363e3cf48ce0ecb5a5883f40bf0f4963b16 (patch) | |
tree | e2becf0ec3fd7da5cf77c9b74d7ecc420817154c | |
parent | 1fb75d69733f6c1787ec9e58894e5ba012283917 (diff) | |
download | eclipse.platform.debug-81dbb363e3cf48ce0ecb5a5883f40bf0f4963b16.tar.gz eclipse.platform.debug-81dbb363e3cf48ce0ecb5a5883f40bf0f4963b16.tar.xz eclipse.platform.debug-81dbb363e3cf48ce0ecb5a5883f40bf0f4963b16.zip |
1GEUYVI
3 files changed, 31 insertions, 10 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreResources.properties b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreResources.properties index 37722de82..81d42bf2f 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreResources.properties +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/DebugCoreResources.properties @@ -49,6 +49,11 @@ launch_manager.error.termination=Unable to terminate launch. process_monitor.label=Process Monitor ############################################################## +# RuntimeProcess +############################################################## +runtime_process.error.terminate_failed=Terminate failed. + +############################################################## # SourceLocation ############################################################## source_location.undetermined=undetermined diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ProcessMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ProcessMonitor.java index f2dde9a35..e329171ae 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ProcessMonitor.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ProcessMonitor.java @@ -67,4 +67,9 @@ public class ProcessMonitor { }
}
+ protected void stopMonitoring() {
+ fOSProcess = null;
+ fThread.interrupt();
+ fProcess.terminated();
+ }
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RuntimeProcess.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RuntimeProcess.java index 59f5ebe25..9c66f632b 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RuntimeProcess.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/RuntimeProcess.java @@ -5,13 +5,7 @@ package org.eclipse.debug.internal.core; * All Rights Reserved.
*/
-import org.eclipse.debug.core.*;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.core.model.IStreamsProxy;
-import org.eclipse.core.runtime.PlatformObject;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.HashMap;
+import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashMap;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugConstants;
import org.eclipse.debug.core.IDebugStatusConstants;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.core.model.IStreamsProxy;
/**
@@ -22,6 +16,14 @@ import java.util.HashMap; * underlying system process for terminataion.
*/
public class RuntimeProcess extends PlatformObject implements IProcess {
+
+ private final static String PREFIX= "runtime_process.";
+
+ private final static String ERROR = PREFIX + "error.";
+ private final static String TERMINATE_FAILED = ERROR + "terminate_failed";
+
+ private static final int MAX_WAIT_FOR_DEATH_ATTEMPTS = 10;
+
/**
* The system process
*/
@@ -132,9 +134,18 @@ public class RuntimeProcess extends PlatformObject implements IProcess { public void terminate() throws DebugException {
if (!isTerminated()) {
fProcess.destroy();
- try {
- fProcess.waitFor();
- } catch (InterruptedException ie) {}
+ int attempts = 0;
+ while (attempts < MAX_WAIT_FOR_DEATH_ATTEMPTS) {
+ try {
+ fProcess.exitValue();
+ return;
+ } catch (IllegalThreadStateException ie) {
+ }
+ }
+ // clean-up
+ fMonitor.stopMonitoring();
+ IStatus status = new Status(IStatus.ERROR, IDebugConstants.PLUGIN_ID, IDebugStatusConstants.TARGET_REQUEST_FAILED, TERMINATE_FAILED, null);
+ throw new DebugException(status);
}
}
|