Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-05-24 15:12:33 -0400
committerJeff Johnston2018-05-25 11:21:58 -0400
commitdda92949539ec43b592195a40daf9b4d823e4945 (patch)
tree53c9ad12947ac9e671909adb41792568cca146c7
parent5a30d65c923536fe8034a8a75590c4992438fb34 (diff)
downloadorg.eclipse.linuxtools-dda92949539ec43b592195a40daf9b4d823e4945.tar.gz
org.eclipse.linuxtools-dda92949539ec43b592195a40daf9b4d823e4945.tar.xz
org.eclipse.linuxtools-dda92949539ec43b592195a40daf9b4d823e4945.zip
Modify DockerConnection attachCommand to use operation token
- add a new version of attachCommand to use an operation token - modify ContainerCommandProcess to use the new version of attachCommand similar to how attachLog is used there Change-Id: Id9f2dd29440d73c9b2892796e5199763fa647bd5 Reviewed-on: https://git.eclipse.org/r/123292 Tested-by: CI Bot Reviewed-by: Jeff Johnston <jjohnstn@redhat.com>
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerConnection2.java3
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java9
-rw-r--r--containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/launch/ContainerCommandProcess.java3
3 files changed, 12 insertions, 3 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerConnection2.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerConnection2.java
index b5e985f460..bdd835ff54 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerConnection2.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/docker/core/IDockerConnection2.java
@@ -77,8 +77,9 @@ public interface IDockerConnection2 {
* Retrieve an Image by id
*
* @param id
- * of Image
+ * of Image
* @return the IDockerImage or null if not found
+ * @since 4.0
*/
IDockerImage getImage(String id);
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 76e6b2c254..a6667631a6 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
@@ -2101,10 +2101,17 @@ public class DockerConnection
public void attachCommand(final String id, final InputStream in,
final DockerConsoleOutputStream out)
throws DockerException {
+ attachCommand(client, id, in, out);
+ }
+
+ public void attachCommand(final Closeable token, final String id,
+ final InputStream in, final DockerConsoleOutputStream out)
+ throws DockerException {
final byte[] prevCmd = new byte[1024];
try {
- final LogStream pty_stream = client.attachContainer(id,
+ final LogStream pty_stream = ((DockerClient) token).attachContainer(
+ id,
AttachParameter.STDIN, AttachParameter.STDOUT,
AttachParameter.STDERR, AttachParameter.STREAM,
AttachParameter.LOGS);
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 6a395457f8..ddfa8c6777 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
@@ -103,6 +103,7 @@ public class ContainerCommandProcess extends Process {
try (PipedOutputStream pipedStdout = new PipedOutputStream(stdout);
PipedOutputStream pipedStderr = new PipedOutputStream(
stderr);
+ Closeable inputToken = ((DockerConnection) connection).getOperationToken();
Closeable token = ((DockerConnection) connection)
.getOperationToken()) {
pipedOut = pipedStdout;
@@ -122,7 +123,7 @@ public class ContainerCommandProcess extends Process {
Thread.sleep(50);
state = connection.getContainerInfo(containerId).state();
if (state.running()) {
- ((DockerConnection) connection).attachCommand(containerId, pipedStdinIn, null);
+ ((DockerConnection) connection).attachCommand(inputToken, containerId, pipedStdinIn, null);
}
}
((DockerConnection) connection).attachLog(token, containerId, pipedStdout, pipedStderr);

Back to the top