Run configuration for Cucumber with steps written in JRuby & Java : ANSI coloring support

This commit is contained in:
Roman Chernyatchik
2011-10-17 13:28:12 +04:00
parent 8dc5d4c64b
commit 6bcaa08875
5 changed files with 21 additions and 2 deletions
@@ -39,7 +39,11 @@ public abstract class JavaCommandLineState extends CommandLineState implements J
@NotNull
protected OSProcessHandler startProcess() throws ExecutionException {
return JavaCommandLineStateUtil.startProcess(createCommandLine());
return JavaCommandLineStateUtil.startProcess(createCommandLine(), ansiColoringEnabled());
}
protected boolean ansiColoringEnabled() {
return false;
}
protected abstract JavaParameters createJavaParameters() throws ExecutionException;
@@ -15,6 +15,7 @@
*/
package com.intellij.execution.configurations;
import com.intellij.execution.process.ColoredProcessHandler;
import com.intellij.execution.process.DefaultJavaProcessHandler;
import com.intellij.execution.process.OSProcessHandler;
import com.intellij.execution.process.ProcessTerminatedListener;
@@ -30,7 +31,15 @@ public class JavaCommandLineStateUtil {
@NotNull
public static OSProcessHandler startProcess(@NotNull final GeneralCommandLine commandLine) throws ExecutionException {
final DefaultJavaProcessHandler processHandler = new DefaultJavaProcessHandler(commandLine);
return startProcess(commandLine, false);
}
@NotNull
public static OSProcessHandler startProcess(@NotNull final GeneralCommandLine commandLine,
final boolean ansiColoring) throws ExecutionException {
final OSProcessHandler processHandler = ansiColoring ? new ColoredProcessHandler(commandLine)
: new DefaultJavaProcessHandler(commandLine);
ProcessTerminatedListener.attach(processHandler);
return processHandler;
}