File tree 1 file changed +10
-6
lines changed
jansi/src/main/java/org/fusesource/jansi
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -79,12 +79,8 @@ public static void main(String... args) throws IOException {
79
79
80
80
System .out .println ();
81
81
82
- int isattyValueReturned = isatty (CLibrary .STDOUT_FILENO );
83
- if ( isattyValueReturned == 0 ) {
84
- System .out .println ("stdout is *NOT* a TTY, 'isatty' has a value of " + isattyValueReturned );
85
- } else {
86
- System .out .println ("stdout *IS* a TTY, 'isatty' has a value of " + isattyValueReturned );
87
- }
82
+ diagnoseTty (false ); // System.out
83
+ diagnoseTty (true ); // System.err
88
84
89
85
AnsiConsole .systemInstall ();
90
86
try {
@@ -130,6 +126,14 @@ private static String getJansiVersion() {
130
126
return ( p == null ) ? null : p .getImplementationVersion ();
131
127
}
132
128
129
+ private static void diagnoseTty (boolean stderr ) {
130
+ int fd = stderr ? CLibrary .STDERR_FILENO : CLibrary .STDOUT_FILENO ;
131
+ int isatty = isatty (fd );
132
+
133
+ System .out .println ("isatty(STD" + (stderr ? "ERR" : "OUT" ) + "_FILENO)= " + isatty + ", System."
134
+ + (stderr ? "err" : "out" ) + " " + ((isatty == 0 ) ? "is *NOT*" : "is" ) + " a terminal" );
135
+ }
136
+
133
137
private static String getPomPropertiesVersion (String path ) throws IOException {
134
138
InputStream in = AnsiMain .class .getResourceAsStream ("/META-INF/maven/" + path + "/pom.properties" );
135
139
if (in == null ) {
You can’t perform that action at this time.
0 commit comments