diff --git a/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentLoggingHandler.java b/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentLoggingHandler.java index 7055bace613b..029909ad9259 100644 --- a/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentLoggingHandler.java +++ b/platform/remote-servers/agent-rt/src/com/intellij/remoteServer/agent/util/CloudAgentLoggingHandler.java @@ -17,6 +17,8 @@ package com.intellij.remoteServer.agent.util; import com.intellij.remoteServer.agent.util.log.LogListener; +import java.io.OutputStream; + /** * @author michael.golubev */ @@ -25,4 +27,6 @@ public interface CloudAgentLoggingHandler { void println(String message); LogListener getOrCreateLogListener(String pipeName); + + LogListener createConsole(String pipeName, OutputStream consoleInput); } diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudGitApplicationRuntime.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudGitApplicationRuntime.java index 5f40b5ac4257..3a34bb456ad6 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudGitApplicationRuntime.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudGitApplicationRuntime.java @@ -45,11 +45,11 @@ public class CloudGitApplicationRuntime extends CloudApplicationRuntime { myDeployment = serverRuntime.getAgent().createDeployment(applicationName, myLoggingHandler); } - protected CloudMultiSourceServerRuntimeInstance getServerRuntime() { + public CloudMultiSourceServerRuntimeInstance getServerRuntime() { return myServerRuntime; } - protected DeploymentLogManager getLogManager() { + public DeploymentLogManager getLogManager() { return myLogManager; } diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudLoggingHandlerImpl.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudLoggingHandlerImpl.java index 346bd0af3046..89535ab6b8e6 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudLoggingHandlerImpl.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudLoggingHandlerImpl.java @@ -15,11 +15,14 @@ */ package com.intellij.remoteServer.util; +import com.intellij.execution.process.ProcessHandler; import com.intellij.remoteServer.agent.util.CloudAgentLoggingHandler; import com.intellij.remoteServer.agent.util.log.LogListener; import com.intellij.remoteServer.runtime.deployment.DeploymentLogManager; import com.intellij.remoteServer.runtime.log.LoggingHandler; +import org.jetbrains.annotations.Nullable; +import java.io.OutputStream; import java.util.HashMap; /** @@ -60,4 +63,40 @@ public class CloudLoggingHandlerImpl implements CloudAgentLoggingHandler { } return logListener; } + + @Override + public LogListener createConsole(String pipeName, final OutputStream consoleInput) { + final LoggingHandler loggingHandler = myLogManager.addAdditionalLog(pipeName); + loggingHandler.attachToProcess(new ProcessHandler() { + + @Override + protected void destroyProcessImpl() { + + } + + @Override + protected void detachProcessImpl() { + + } + + @Override + public boolean detachIsDefault() { + return false; + } + + @Nullable + @Override + public OutputStream getProcessInput() { + return consoleInput; + } + }); + + return new LogListener() { + + @Override + public void lineLogged(String line) { + loggingHandler.print(line); + } + }; + } } diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudSilentLoggingHandlerImpl.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudSilentLoggingHandlerImpl.java index 49321fdfc398..31825120100a 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudSilentLoggingHandlerImpl.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/CloudSilentLoggingHandlerImpl.java @@ -4,6 +4,8 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.remoteServer.agent.util.CloudAgentLoggingHandler; import com.intellij.remoteServer.agent.util.log.LogListener; +import java.io.OutputStream; + /** * @author michael.golubev */ @@ -20,4 +22,9 @@ public class CloudSilentLoggingHandlerImpl implements CloudAgentLoggingHandler { public LogListener getOrCreateLogListener(String pipeName) { return LogListener.NULL; } + + @Override + public LogListener createConsole(String pipeName, OutputStream consoleInput) { + return LogListener.NULL; + } }