Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable 'command echoing' #231

Open
ghost opened this issue Jan 25, 2016 · 4 comments
Open

How to disable 'command echoing' #231

ghost opened this issue Jan 25, 2016 · 4 comments

Comments

@ghost
Copy link

ghost commented Jan 25, 2016

With the following simple code, pressing 'Enter' results with the ConsoleReader repeating/echoing my command back to me:

ConsoleReader reader = new ConsoleReader();
reader.setPrompt("myapp>");
String line;
while ((line = reader.readLine()) != null) {
    writer.println("Ehh, what?!?");
    writer.flush();
}

Again, produces:

myapp>Hello
Hello
Ehh, what?!?

I would like to disable this echoing if at all possible, but wasn't sure what the reason for it was in the first place. Instead, I'd like:

myapp>Hello
Ehh, what?!?

Any ideas/thoughts? I'd be happy to submit a PR for this if it sounds like something the community would like to embrace.

@seeruk
Copy link

seeruk commented Mar 6, 2016

Another note, if you specify a mask, it seems to output the thing you're actually typing, and then the mask, like:

> run
[info] Running ApplicationMain
Tell me something sensitive: test
****
Tell me something sensitive again: test
****
Tell me something sensitive again again: test
****
test
test
test

The only time the word test should be output as the three times at the end, as that was what I typed in - and it should have been masked.

@gnodet
Copy link
Member

gnodet commented Mar 14, 2016

The code should work. I've just tested it on OsX and Windows.

@seeruk
Copy link

seeruk commented Mar 14, 2016

To provide an update on my situation with this I did manage to make this work, it was something to do with JLine not having a valid set of terminal settings to restore to (or something to that effect, I'm not 100% sure).

Here's the file with the fix for my specific issue in (inspired by SBT's implementation of JLine): https://gist.github.com/SeerUK/ade30d23b009fb258e31

@cdosborn
Copy link

I have the same issue. OSX 10.11.3 running Terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants