Skip to content

Commit

Permalink
add CONSOLE_OPTIONS boolean variable redirectColor to switch on/off r…
Browse files Browse the repository at this point in the history
…edirect colors
  • Loading branch information
mattirn committed Dec 7, 2022
1 parent 9711716 commit 9243e6d
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2021, the original author or authors.
* Copyright (c) 2002-2022, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand Down Expand Up @@ -472,7 +472,7 @@ public void redirect(File file, boolean append) throws IOException {
outputStream = new FileOutputStream(file, append);
}

public void open() throws IOException {
public void open(boolean redirectColor) throws IOException {
if (redirecting || outputStream == null) {
return;
}
Expand All @@ -490,9 +490,8 @@ public void open() throws IOException {
terminal = TerminalBuilder.builder()
.streams(in, outputStream)
.attributes(attrs)
.jna(false)
.jansi(false)
.type(Terminal.TYPE_DUMB).build();
.type((redirectColor ? Terminal.TYPE_DUMB_COLOR : Terminal.TYPE_DUMB))
.build();
this.commandSession = new CommandRegistry.CommandSession(terminal, terminal.input(), out, out);
redirecting = true;
} catch (IOException e) {
Expand Down Expand Up @@ -1176,7 +1175,7 @@ public Object execute(String line) throws Exception {
} else if (consoleId != null) {
outputStream.redirect();
}
outputStream.open();
outputStream.open(consoleOption("redirectColor", false));
}
boolean consoleScript = false;
try {
Expand Down

0 comments on commit 9243e6d

Please sign in to comment.