From ae6fbdcc5ada29f0f94a74a9a2f4affc332170be Mon Sep 17 00:00:00 2001 From: Janne Valkealahti Date: Fri, 3 Nov 2023 17:11:48 +0000 Subject: [PATCH] Upgrade jline 3.24.1 - Disable jni terminal provider in test ShellAutoConfiguration like it's done for jna/jansi - Default TerminalBuilder system outpu to SysOut to restore writing to stdout instead of stderr when redirect exists - Backport #891 - Backport #901 - Fixes #914 - Fixes #911 --- gradle.properties | 2 +- .../shell/boot/JLineShellAutoConfiguration.java | 2 ++ .../shell/test/autoconfigure/ShellAutoConfiguration.java | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 46e07b897..7aba3abc7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ version=3.0.9-SNAPSHOT springBootVersion=3.0.12 nativeBuildToolsVersion=0.9.19 commonsIoVersion=2.11.0 -jlineVersion=3.23.0 +jlineVersion=3.24.1 st4Version=4.3.3 jimfsVersion=1.2 gradleEnterpriseVersion=3.10.3 diff --git a/spring-shell-autoconfigure/src/main/java/org/springframework/shell/boot/JLineShellAutoConfiguration.java b/spring-shell-autoconfigure/src/main/java/org/springframework/shell/boot/JLineShellAutoConfiguration.java index c9789f1ee..0ddeeb178 100644 --- a/spring-shell-autoconfigure/src/main/java/org/springframework/shell/boot/JLineShellAutoConfiguration.java +++ b/spring-shell-autoconfigure/src/main/java/org/springframework/shell/boot/JLineShellAutoConfiguration.java @@ -21,6 +21,7 @@ import org.jline.reader.Parser; import org.jline.terminal.Terminal; import org.jline.terminal.TerminalBuilder; +import org.jline.terminal.TerminalBuilder.SystemOutput; import org.jline.utils.AttributedString; import org.jline.utils.AttributedStyle; @@ -45,6 +46,7 @@ public class JLineShellAutoConfiguration { public Terminal terminal(ObjectProvider customizers) { try { TerminalBuilder builder = TerminalBuilder.builder(); + builder.systemOutput(SystemOutput.SysOut); customizers.orderedStream().forEach(customizer -> customizer.customize(builder)); return builder.build(); } diff --git a/spring-shell-test-autoconfigure/src/main/java/org/springframework/shell/test/autoconfigure/ShellAutoConfiguration.java b/spring-shell-test-autoconfigure/src/main/java/org/springframework/shell/test/autoconfigure/ShellAutoConfiguration.java index ddc694970..f01bd8e91 100644 --- a/spring-shell-test-autoconfigure/src/main/java/org/springframework/shell/test/autoconfigure/ShellAutoConfiguration.java +++ b/spring-shell-test-autoconfigure/src/main/java/org/springframework/shell/test/autoconfigure/ShellAutoConfiguration.java @@ -42,7 +42,8 @@ TerminalCustomizer terminalStreamsTerminalCustomizer(TerminalStreams terminalStr return builder -> { builder.streams(terminalStreams.input, terminalStreams.output) .jansi(false) - .jna(false); + .jna(false) + .jni(false); }; }