File tree 1 file changed +4
-3
lines changed
src/main/java/org/fusesource/jansi
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -264,7 +264,8 @@ private static AnsiPrintStream ansiStream(boolean stdout) {
264
264
else if (IS_WINDOWS ) {
265
265
final long console = GetStdHandle (stdout ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE );
266
266
final int [] mode = new int [1 ];
267
- if (GetConsoleMode (console , mode ) != 0
267
+ final boolean isConsole = GetConsoleMode (console , mode ) != 0 ;
268
+ if (isConsole
268
269
&& SetConsoleMode (console , mode [0 ] | ENABLE_VIRTUAL_TERMINAL_PROCESSING ) != 0 ) {
269
270
SetConsoleMode (console , mode [0 ]); // set it back for now, but we know it works
270
271
processor = null ;
@@ -285,7 +286,7 @@ public void run() throws IOException {
285
286
}
286
287
};
287
288
}
288
- else if (IS_CONEMU || IS_CYGWIN || IS_MSYSTEM ) {
289
+ else if (( IS_CONEMU || IS_CYGWIN || IS_MSYSTEM ) && ! isConsole ) {
289
290
// ANSI-enabled ConEmu, Cygwin or MSYS(2) on Windows...
290
291
processor = null ;
291
292
type = AnsiType .Native ;
@@ -406,7 +407,7 @@ else if (term != null && term.contains("-256color")) {
406
407
407
408
// If the jansi.noreset property is not set, reset the attributes
408
409
// when the stream is closed
409
- boolean resetAtUninstall = !getBoolean (JANSI_NORESET );
410
+ boolean resetAtUninstall = type != AnsiType . Unsupported && !getBoolean (JANSI_NORESET );
410
411
411
412
Charset cs = Charset .defaultCharset ();
412
413
if (enc != null ) {
You can’t perform that action at this time.
0 commit comments