This is an automated email from the ASF dual-hosted git repository.

ddanielr pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/2.1 by this push:
     new b140460c06 Adds property for jline to prefer using stdout vs stderr 
(#5221)
b140460c06 is described below

commit b140460c06ca4ac6eaab8f8c1fda65db858e486b
Author: Daniel Roberts <ddani...@gmail.com>
AuthorDate: Mon Jan 13 12:06:14 2025 -0500

    Adds property for jline to prefer using stdout vs stderr (#5221)
    
    * Adds property for jline to always use stdout
    
    When the shell is being used with a `-e <command>` option jline does not
    write the output on stdout when also used with a pipe `|` operator.
    
    Instead the output is written to stderr. This causes frustration when
    attempting to script actions using the accumulo shell.
    
    * Set system out in TerminalBuilder instead
    
    Change the output behavior manually instead of using the jline
    properties.
---
 shell/src/main/java/org/apache/accumulo/shell/Shell.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java 
b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index 615b2cc4c8..eafe3d69e1 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -175,6 +175,7 @@ import org.jline.reader.impl.LineReaderImpl;
 import org.jline.terminal.Attributes;
 import org.jline.terminal.Terminal;
 import org.jline.terminal.TerminalBuilder;
+import org.jline.terminal.TerminalBuilder.SystemOutput;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -300,7 +301,8 @@ public class Shell extends ShellOptions implements 
KeywordExecutable {
    */
   public boolean config(String... args) throws IOException {
     if (this.terminal == null) {
-      this.terminal = TerminalBuilder.builder().jansi(false).build();
+      this.terminal =
+          
TerminalBuilder.builder().jansi(false).systemOutput(SystemOutput.SysOut).build();
     }
     if (this.reader == null) {
       this.reader = 
LineReaderBuilder.builder().terminal(this.terminal).build();

Reply via email to