Skip to content

Commit

Permalink
'isatty' check added to test
Browse files Browse the repository at this point in the history
  • Loading branch information
dejan2609 committed Sep 15, 2017
1 parent 257b1de commit e35a57f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions jansi/src/main/java/org/fusesource/jansi/AnsiMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import org.fusesource.hawtjni.runtime.Library;
import org.fusesource.jansi.internal.CLibrary;
import static org.fusesource.jansi.internal.CLibrary.isatty;

/**
* Main class for the library, providing executable jar to diagnose Jansi setup.
Expand Down Expand Up @@ -76,6 +77,15 @@ public static void main(String... args) throws IOException {
System.out.println("IS_MINGW= " + AnsiConsole.IS_MINGW);
}

System.out.println();

int isattyValueReturned = isatty(CLibrary.STDOUT_FILENO);
if( isattyValueReturned == 0 ) {
System.out.println("stdout is *NOT* a TTY, 'isatty' has a value of " + isattyValueReturned);
} else {
System.out.println("stdout *IS* a TTY, 'isatty' has a value of " + isattyValueReturned);
}

AnsiConsole.systemInstall();
try {
if (args.length == 0) {
Expand Down

0 comments on commit e35a57f

Please sign in to comment.