Skip to content

Commit 2ef5976

Browse files
author
tksk
committed
support jansi.force property to force ansi escapes
1 parent 9bab505 commit 2ef5976

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,13 @@ public static OutputStream wrapOutputStream(final OutputStream stream) {
7272

7373
// We must be on some unix variant..
7474
try {
75+
// If the jansi.force property is set, then we force to output
76+
// the ansi escapes for piping it into ansi color aware commands (e.g. less -r)
77+
boolean forceColored = Boolean.getBoolean("jansi.force");
7578
// If we can detect that stdout is not a tty.. then setup
7679
// to strip the ANSI sequences..
7780
int rc = isatty(STDOUT_FILENO);
78-
if( rc==0 ) {
81+
if( !forceColored && rc==0 ) {
7982
return new AnsiOutputStream(stream);
8083
}
8184

0 commit comments

Comments
 (0)