aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-06-04 18:54:22 -0400
committerJeff Johnston2018-06-06 09:55:25 -0400
commit76798f9d71df43e6605765782ad4a97dcb333e59 (patch)
treee6099b13f2b2c27e9a705091b82e074e2c516ae0
parent8bf091702f454c70a3aa7cfb947b83ca6cc9f11c (diff)
downloadorg.eclipse.linuxtools-76798f9d71df43e6605765782ad4a97dcb333e59.tar.gz
org.eclipse.linuxtools-76798f9d71df43e6605765782ad4a97dcb333e59.tar.xz
org.eclipse.linuxtools-76798f9d71df43e6605765782ad4a97dcb333e59.zip
Bug 535524 - Latest Docker Tooling creates extraneous Terminals
- add new parameter to DockerConnection attachCommand with token so that it can specify if a terminal needs to be opened - in ContainerCommandProcess, set the terminal boolean to false when calling attachCommand for a tty application Change-Id: Icdfcc88e033209e065f7bfb59be7f807ae26f740 Reviewed-on: https://git.eclipse.org/r/123952 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java15
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java7
2 files changed, 13 insertions, 9 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
index 7fa08eaf94..6a02351a9d 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
@@ -1762,6 +1762,12 @@ public class DockerConnection
@Override
public void startContainer(final String id, final OutputStream stream)
throws DockerException, InterruptedException {
+ startContainer(client, id, stream);
+ }
+
+ public void startContainer(final Closeable token, final String id,
+ final OutputStream stream)
+ throws DockerException, InterruptedException {
final IDockerContainerInfo containerInfo = getContainerInfo(id);
if (containerInfo == null) {
throw new DockerException(DockerMessages
@@ -1769,7 +1775,7 @@ public class DockerConnection
}
try {
// start container
- client.startContainer(id);
+ ((DockerClient) token).startContainer(id);
// Log the started container if a stream is provided
if (stream != null && containerInfo != null
&& containerInfo.config() != null
@@ -2141,11 +2147,12 @@ public class DockerConnection
public void attachCommand(final String id, final InputStream in,
final DockerConsoleOutputStream out)
throws DockerException {
- attachCommand(client, id, in, out);
+ attachCommand(client, id, in, out, true);
}
public void attachCommand(final Closeable token, final String id,
- final InputStream in, final DockerConsoleOutputStream out)
+ final InputStream in, final DockerConsoleOutputStream out,
+ final boolean openTTY)
throws DockerException {
final byte[] prevCmd = new byte[1024];
@@ -2159,7 +2166,7 @@ public class DockerConnection
final boolean isTtyEnabled = info.config().tty();
final boolean isOpenStdin = info.config().openStdin();
- if (isTtyEnabled) {
+ if (isTtyEnabled && openTTY) {
openTerminal(pty_stream, info.name(), out);
}
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 56b608e030..4461e9d607 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
@@ -125,7 +125,8 @@ public class ContainerCommandProcess extends Process {
Thread.sleep(50);
state = connection.getContainerInfo(containerId).state();
if (state.running()) {
- ((DockerConnection) connection).attachCommand(inputToken, containerId, pipedStdinIn, null);
+ ((DockerConnection) connection).attachCommand(inputToken, containerId, pipedStdinIn, null,
+ false);
((DockerConnection) connection).attachContainerOutput(token, containerId, pipedStdout,
pipedStderr);
}
@@ -251,10 +252,6 @@ public class ContainerCommandProcess extends Process {
if (!threadDone) {
// we are stuck
try {
- Activator.logWarningMessage(
- LaunchMessages.getFormattedString(
- "ContainerLoggingNotResponding.msg", //$NON-NLS-1$
- containerId.substring(0, 8)));
this.stdout.close();
this.stderr.close();
this.stdin.close();