Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2017-11-01 16:57:15 +0000
committerJeff Johnston2017-11-01 18:32:25 +0000
commitc224aa8ac04a33717937bd058ed73e81f84fffeb (patch)
tree7f8b114129f8ddc34e4172440ba25048deaf84d5
parentaff987bcf3968cadea7ab3d012aecd1bff70d4ae (diff)
downloadorg.eclipse.linuxtools-c224aa8ac04a33717937bd058ed73e81f84fffeb.tar.gz
org.eclipse.linuxtools-c224aa8ac04a33717937bd058ed73e81f84fffeb.tar.xz
org.eclipse.linuxtools-c224aa8ac04a33717937bd058ed73e81f84fffeb.zip
Bug 526725 - ContainerCommandProcess causes Container not found
- stash exit value when deleting the Container in waitFor method so that when caller calls exitValue() method, the Container is not required to exist Change-Id: I8640908aee544ab30a1e2f192e00ad14fb024f4d Reviewed-on: https://git.eclipse.org/r/110871 Tested-by: Hudson CI 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.java9
1 files changed, 9 insertions, 0 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 f58778edb7..e73bc59cf0 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
@@ -51,6 +51,8 @@ public class ContainerCommandProcess extends Process {
private Map<String, String> remoteVolumes;
private boolean keepContainer;
private Thread thread;
+ private boolean containerRemoved;
+ private int exitValue;
public ContainerCommandProcess(IDockerConnection connection,
String imageName, String containerId,
@@ -128,6 +130,11 @@ public class ContainerCommandProcess extends Process {
@Override
public int exitValue() {
+ // if container has been removed, we need to return
+ // the exit value that we cached before removal
+ if (containerRemoved) {
+ return exitValue;
+ }
IDockerContainerInfo info = connection
.getContainerInfo(containerId);
if (info != null) {
@@ -297,6 +304,8 @@ public class ContainerCommandProcess extends Process {
}
connection.stopLoggingThread(containerId);
if (!keepContainer) {
+ exitValue = exitValue();
+ containerRemoved = true;
connection.removeContainer(containerId);
}
if (!((DockerConnection) connection).isLocal()) {

Back to the top