ddanielr opened a new pull request, #5221:
URL: https://github.com/apache/accumulo/pull/5221
When the shell is being used with an execute command and pipe `./accumulo
shell -e '<command>' | grep "<>"`,
jline does not write the output on stdout and instead writes it to stderr.
This causes frustration when attempting to script actions using the accumulo
shell.
Without Property Set:
```
$ ./accumulo shell -e 'scan -t accumulo.root -np' | grep localhost
2024-12-31T05:15:59,532 [shell.Shell] INFO : Loading configuration from
/workspace/fluo-uno/install/accumulo-2.1.3/conf/accumulo-client.properties
!0;~ file:hdfs://localhost:8020/accumulo/tables/!0/table_info/0_1.rf []
0,0
!0;~ loc:10000501ae30004 [] localhost:9997
!0;~ srv:dir [] table_info
!0;~ srv:flush [] 4
!0;~ srv:lock []
tservers/localhost:9997/zlock#d923681f-93ab-498f-b32e-0abf799b8354#0000000000$10000501ae30004
!0;~ srv:time [] L0
!0;~ ~tab:~pr [] \x00
!0< loc:10000501ae30004 [] localhost:9997
!0< srv:dir [] default_tablet
!0< srv:flush [] 4
!0< srv:lock []
tservers/localhost:9997/zlock#d923681f-93ab-498f-b32e-0abf799b8354#0000000000$10000501ae30004
!0< srv:time [] L0
!0< ~tab:~pr [] \x01~
```
With Property Set:
```
$ ./accumulo shell -e 'scan -t accumulo.root -np' | grep localhost
!0;~ file:hdfs://localhost:8020/accumulo/tables/!0/table_info/0_1.rf []
0,0
!0;~ loc:10000501ae30004 [] localhost:9997
!0;~ srv:lock []
tservers/localhost:9997/zlock#d923681f-93ab-498f-b32e-0abf799b8354#0000000000$10000501ae30004
!0< loc:10000501ae30004 [] localhost:9997
!0< srv:lock []
tservers/localhost:9997/zlock#d923681f-93ab-498f-b32e-0abf799b8354#0000000000$10000501ae30004
```
What made this odd was that the shell writes to stdout if not using a pipe
`|` as redirecting the output to a file works
`/accumulo shell -e '<command>' > output.txt`
Related Jline Code:
https://github.com/jline/jline3/blob/c75301facc8716b59c1d57d3e3c5943358022560/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java#L541
https://github.com/jline/jline3/blob/c75301facc8716b59c1d57d3e3c5943358022560/terminal/src/main/java/org/jline/terminal/TerminalBuilder.java#L588
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]