public OutputEventRenderer addStandardOutputAndError() {
TerminalDetector terminalDetector = new TerminalDetector();
boolean stdOutIsTerminal = terminalDetector.isSatisfiedBy(FileDescriptor.out);
boolean stdErrIsTerminal = terminalDetector.isSatisfiedBy(FileDescriptor.err);
if (stdOutIsTerminal) {
PrintStream outStr = org.fusesource.jansi.AnsiConsole.out();
Console console = new AnsiConsole(outStr, outStr, colourMap);
addConsole(console, true, stdErrIsTerminal);
} else if (stdErrIsTerminal) {
// Only stderr is connected to a terminal
PrintStream errStr = org.fusesource.jansi.AnsiConsole.err();
Console console = new AnsiConsole(errStr, errStr, colourMap);
addConsole(console, false, true);
}
if (!stdOutIsTerminal) {
addStandardOutput(System.out);