Skip to content

Commit

Permalink
Adds property for jline to prefer using stdout vs stderr (#5221)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
ddanielr authored Jan 13, 2025
1 parent 6fe8b0c commit b140460
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion shell/src/main/java/org/apache/accumulo/shell/Shell.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
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;

Expand Down Expand Up @@ -300,7 +301,8 @@ private AuthenticationToken getAuthenticationToken(String principal, String auth
*/
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();
Expand Down

0 comments on commit b140460

Please sign in to comment.