From 6f52ee5d4d43afd0f242b004f4524d21ee941e47 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Fri, 25 May 2018 14:58:31 -0400 Subject: Revert change to use attachContainerOutput - previous change causes regression to CDT Container build - previous change requires Container to be running at time of attach but we can't guarantee that the Container hasn't already finished in which case we get an exception or possibly miss output - instead key off the requirement of stdin; if specified, assume command is interactive and use attachContainerOutput, otherwise use attachLogs so the command can already be finished Change-Id: I5a7d7d48c456d4dabea7b6dc591708fcf1ab676f Reviewed-on: https://git.eclipse.org/r/123368 Tested-by: CI Bot Reviewed-by: Jeff Johnston --- .../internal/docker/ui/launch/ContainerCommandProcess.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 f88a0a70d0..ab10415cfe 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 @@ -124,9 +124,12 @@ public class ContainerCommandProcess extends Process { state = connection.getContainerInfo(containerId).state(); if (state.running()) { ((DockerConnection) connection).attachCommand(inputToken, containerId, pipedStdinIn, null); + ((DockerConnection) connection).attachContainerOutput(token, containerId, pipedStdout, + pipedStderr); } + } else { + ((DockerConnection) connection).attachLog(token, containerId, pipedStdout, pipedStderr); } - ((DockerConnection) connection).attachContainerOutput(token, containerId, pipedStdout, pipedStderr); pipedStdout.flush(); pipedStderr.flush(); } catch (DockerException | InterruptedException | IOException e) { -- cgit v1.2.3