Skip to content

Commit 37b2a82

Browse files
committed
fix: Pty4j with JLine in raw mode does indeed avoid Shell echo (fixes #1410)
1 parent d6f6bf3 commit 37b2a82

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

java/dev/enola/common/exec/pty/Demo.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,12 @@
2828

2929
public class Demo {
3030

31-
public static void main(String[] args) throws IOException, InterruptedException {
32-
// TODO system(false)
33-
try (Terminal terminal = TerminalBuilder.builder().system(true).build()) {
34-
// TODO .systemOutput(ForcedSysOut) ?
31+
// FTR https://github.com/JetBrains/pty4j/issues/170
3532

36-
// TODO Fix the (ugly) "echo" which "re-displays" all Fish shell input again
37-
// This does not work well, see https://github.com/JetBrains/pty4j/issues/170;
38-
// Disabling echo does NOT help: terminal.echo(false);
39-
// Do NOT enter raw, it's worse: terminal.enterRawMode();
33+
public static void main(String[] args) throws IOException, InterruptedException {
34+
try (Terminal terminal = TerminalBuilder.builder().build()) {
35+
terminal.enterRawMode();
36+
// NB: terminal.echo() true or false makes no difference (because we're in raw mode)
4037

4138
int result;
4239
// TODO Read from $SHELL (and use cmd.exe on Windows)
@@ -52,7 +49,6 @@ public static void main(String[] args) throws IOException, InterruptedException
5249
requireNonNull(terminal.output(), "terminal.output"),
5350
null,
5451
true)) {
55-
// System.out.println("Running, and awaiting exit of: " + String.join(" ", cmd));
5652
resize(terminal, runner);
5753
terminal.handle(Terminal.Signal.WINCH, signal -> resize(terminal, runner));
5854
result = runner.waitForExit();

0 commit comments

Comments
 (0)