IDEA-155007 check shouldKillProcessSoftly
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Mon, 7 Nov 2016 09:21:50 +0000 (10:21 +0100)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Mon, 7 Nov 2016 09:21:50 +0000 (10:21 +0100)
java/debugger/impl/src/com/intellij/debugger/impl/DebuggerManagerImpl.java
platform/platform-impl/src/com/intellij/execution/process/KillableProcessHandler.java

index ab33f12c73306a1b9f51781e6b353172299adb77..919d7bd344dd7c3007e2a54bafb90e34701089e9 100644 (file)
@@ -243,11 +243,12 @@ public class DebuggerManagerImpl extends DebuggerManagerEx implements Persistent
       processHandler.addProcessListener(new ProcessAdapter() {
         @Override
         public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) {
-          final DebugProcessImpl debugProcess = getDebugProcess(event.getProcessHandler());
+          ProcessHandler processHandler = event.getProcessHandler();
+          final DebugProcessImpl debugProcess = getDebugProcess(processHandler);
           if (debugProcess != null) {
             // if current thread is a "debugger manager thread", stop will execute synchronously
             // it is KillableColoredProcessHandler responsibility to terminate VM
-            debugProcess.stop(willBeDestroyed && !(event.getProcessHandler() instanceof KillableColoredProcessHandler));
+            debugProcess.stop(willBeDestroyed && !(processHandler instanceof KillableColoredProcessHandler && ((KillableColoredProcessHandler)processHandler).shouldKillProcessSoftly()));
 
             // wait at most 10 seconds: the problem is that debugProcess.stop() can hang if there are troubles in the debuggee
             // if processWillTerminate() is called from AWT thread debugProcess.waitFor() will block it and the whole app will hang
index ef0cf56c164b8065e81408e091bbced1fb352bfd..7bafa9af0a2a796ba92a97c80033f52bbb4c5323 100644 (file)
@@ -80,7 +80,7 @@ public class KillableProcessHandler extends OSProcessHandler implements Killable
   /**
    * @return true, if graceful process termination should be attempted first
    */
-  protected boolean shouldKillProcessSoftly() {
+  public boolean shouldKillProcessSoftly() {
     return myShouldKillProcessSoftly;
   }