Fix color output for file / tty #358

This commit is contained in:
Guillaume Nodet
2021-02-15 17:06:02 +01:00
parent 4c4b961fb5
commit 7fb15766b1
3 changed files with 46 additions and 7 deletions

View File

@@ -72,6 +72,12 @@ public class DefaultClient implements Client {
}
}
// Color
String color = Environment.COLOR.removeCommandLineOption(args);
if (color == null) {
color = Environment.COLOR.getDefault();
}
// Serial
if (Environment.SERIAL.removeCommandLineOption(args) != null) {
System.setProperty(Environment.SERIAL.getProperty(), Boolean.toString(true));
@@ -93,7 +99,7 @@ public class DefaultClient implements Client {
int exitCode = 0;
boolean noBuffering = batchMode || parameters.noBuffering();
try (TerminalOutput output = new TerminalOutput(noBuffering, parameters.rollingWindowSize(), logFile)) {
try (TerminalOutput output = new TerminalOutput(noBuffering, parameters.rollingWindowSize(), logFile, color)) {
try {
final ExecutionResult result = new DefaultClient(parameters).execute(output, args);
exitCode = result.getExitCode();