IDEA-129347 - Heroku: bash console

This commit is contained in:
Michael Golubev
2014-09-02 16:48:40 +02:00
parent 8d4c32052a
commit 2e498bb96c
4 changed files with 52 additions and 2 deletions
@@ -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);
}
@@ -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;
}
@@ -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);
}
};
}
}
@@ -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;
}
}