Skip to content

Commit

Permalink
Merge pull request #20 from tksk/master
Browse files Browse the repository at this point in the history
 support jansi.force property to force ansi escapes
  • Loading branch information
davsclaus committed Apr 7, 2014
2 parents fc87486 + 2ef5976 commit 5f202de
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 5f202de

Please sign in to comment.