Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-05-18 13:06:28 -0400
committerJeff Johnston2018-05-18 14:46:35 -0400
commitba0709f8e2af13ed68ec802e5669ba776c118347 (patch)
treed51a84d11ac77027266023f026dd06e4f31ba6f5
parentcaa1a73b18c10a0836dbdf2ed4c5f8942a14fcbd (diff)
downloadorg.eclipse.linuxtools-ba0709f8e2af13ed68ec802e5669ba776c118347.tar.gz
org.eclipse.linuxtools-ba0709f8e2af13ed68ec802e5669ba776c118347.tar.xz
org.eclipse.linuxtools-ba0709f8e2af13ed68ec802e5669ba776c118347.zip
Bug 534682 - Terminate in Debug view doesn't work for Docker Run Image
- fix ContainerCommandProcess destroy() method to kill the container - remove synchronized specifier as destroy should be able to run at same time as waitFor() - do the same for exitValue() method Change-Id: I191bdff5b40ccd495d7efe43ef396384897a77cc Reviewed-on: https://git.eclipse.org/r/122979 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java
index 4e0cf600fc..8c96982510 100644
--- a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java
+++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java
@@ -126,15 +126,13 @@ public class ContainerCommandProcess extends Process {
}
@Override
- public synchronized void destroy() {
+ public void destroy() {
try {
+ // kill the container
try {
- // TODO: see if there is a better way of draining the
- // container output before closing the streams. Note
- // that trying to join the attachLog thread does not
- // work.
+ connection.killContainer(containerId);
Thread.sleep(1000);
- } catch (InterruptedException e1) {
+ } catch (DockerException | InterruptedException e) {
// ignore
}
// give logging thread at most 5 seconds to terminate
@@ -154,7 +152,7 @@ public class ContainerCommandProcess extends Process {
}
@Override
- public synchronized int exitValue() {
+ public int exitValue() {
// if container has been removed, we need to return
// the exit value that we cached before removal
if (containerRemoved) {
@@ -173,6 +171,9 @@ public class ContainerCommandProcess extends Process {
return state.exitCode();
}
}
+ if (containerRemoved) {
+ return exitValue;
+ }
return -1;
}

Back to the top