Skip to content

Commit 3ad1f9c

Browse files
committed
Kill zombie process in tests
node-debug doesn't react well to "destroy". LSP4E fixes it later with eclipse-lsp4e/lsp4e#122 , but in the meantime, we need a workaround.
1 parent dbceaff commit 3ad1f9c

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

org.eclipse.wildwebdeveloper.tests/META-INF/MANIFEST.MF

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: Tests for WildWebDeveloper
44
Bundle-SymbolicName: org.eclipse.wildwebdeveloper.tests;singleton:=true
5-
Bundle-Version: 0.4.17.qualifier
5+
Bundle-Version: 0.4.18.qualifier
66
Bundle-Vendor: Eclipse Wild Web Developer
77
Automatic-Module-Name: org.eclipse.wildwebdeveloper.tests
88
Bundle-RequiredExecutionEnvironment: JavaSE-11
@@ -23,5 +23,6 @@ Require-Bundle: org.eclipse.wildwebdeveloper;bundle-version="0.5.19",
2323
org.eclipse.debug.ui,
2424
org.eclipse.core.filesystem,
2525
org.eclipse.ui.editors,
26-
org.eclipse.ui.console;bundle-version="3.11.0"
26+
org.eclipse.ui.console;bundle-version="3.11.0",
27+
org.eclipse.lsp4e.debug;bundle-version="0.13.0"
2728
Import-Package: org.eclipse.ui.editors.text

org.eclipse.wildwebdeveloper.tests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<version>0.5.0-SNAPSHOT</version>
88
</parent>
99
<packaging>eclipse-test-plugin</packaging>
10-
<version>0.4.17-SNAPSHOT</version>
10+
<version>0.4.18-SNAPSHOT</version>
1111
<build>
1212
<plugins>
1313
<plugin>

org.eclipse.wildwebdeveloper.tests/src/org/eclipse/wildwebdeveloper/tests/TestDebug.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
3535
import org.eclipse.debug.core.ILaunchManager;
3636
import org.eclipse.debug.core.model.IDebugTarget;
37+
import org.eclipse.debug.core.model.IProcess;
3738
import org.eclipse.debug.core.model.ISuspendResume;
3839
import org.eclipse.debug.core.model.IThread;
3940
import org.eclipse.debug.core.model.IVariable;
@@ -80,6 +81,15 @@ private void removeAllLaunches() throws DebugException {
8081
debugTarget.terminate();
8182
launch.removeDebugTarget(debugTarget);
8283
}
84+
for (IProcess process : launch.getProcesses()) {
85+
process.terminate();
86+
}
87+
// workaround that some debugger process don't terminate as expected
88+
// LSP4E fixes it in later versions: https://github.com/eclipse/lsp4e/pull/122
89+
ProcessHandle.current().descendants()
90+
.filter(process -> process.info().commandLine()
91+
.filter(command -> command.contains("node") && command.contains("debug")).isPresent())
92+
.forEach(ProcessHandle::destroyForcibly);
8393
launchManager.removeLaunch(launch);
8494
}
8595
}

0 commit comments

Comments
 (0)