Skip to content

Commit

Permalink
support jansi.force property to force ansi escapes
Browse files Browse the repository at this point in the history
  • Loading branch information
tksk committed Jul 9, 2013
1 parent 9bab505 commit 2ef5976
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,13 @@ public static OutputStream wrapOutputStream(final OutputStream stream) {

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

Expand Down

0 comments on commit 2ef5976

Please sign in to comment.