Navigation Menu

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

Input does not register when using Mintty #1442

Closed
amitz opened this issue Jun 28, 2015 · 6 comments
Closed

Input does not register when using Mintty #1442

amitz opened this issue Jun 28, 2015 · 6 comments
Labels

Comments

@amitz
Copy link

amitz commented Jun 28, 2015

Hi,

I'm a Windows Ruby developer (we exists :-)) and I'm having problem when using Pry in Mintty terminal. When I try to type input, nothing is being shown on the Pry prompt. When I 'Ctrl C', I can see all the commands I previously tried execute one after the other.

Mintty is used by both Cygwin and MSys2, and I can confirm this problem happens in both. Mintty works fine with Python shell or IRB by the way, so I think it's a Pry issue.

@danowar2k
Copy link

Yeah, this happens here, too (using mintty via git for Windows installation).

Also using cygwin terminal on Windows.

@kyrylo
Copy link
Member

kyrylo commented Jan 17, 2019

Does it work in IRB?

@danowar2k
Copy link

Okay, I've likely missed to point out important facts. I'm working on Windows 7 and trying to debug Vagrant 2.2.1 code. Working from a minTTY mingw64 terminal I used a Vagrantfile to install the Ruby gems "pry-readline" and "pry".

I then tried binding.pry and the prompt shows, I can type stuff, but nothing happens when I press enter.

Do you mean "Does debugging work in IRB?" or "Does starting pry work in IRB?"

I haven't used IRB from git for Windows mintty yet...

@kyrylo
Copy link
Member

kyrylo commented Jan 17, 2019

The issue description says:

When I try to type input, nothing is being shown on the Pry prompt.

When you use IRB, does it suffer from the same problem?

@danowar2k
Copy link

Oh...no, I missed that. Sorry. Typed characters appear on screen. It's only when I type enter that nothing happens. My input is registered and output in the terminal, but it's not really registered in the Ruby program.

The cause seems to be the rb-readline gem, which uses the Win32API:

    @kbhit = Win32API.new("msvcrt", "_kbhit", [], 'I')
[...]
      while (@kbhit.Call == 0)
        # If there is no input, yield the processor for other threads
        sleep(@_keyboard_input_timeout)
      end

kbhit seems to never register the keypresses when using Cygwin or miinTTY, so the rb-readline gem is always in sleep mode.

Seems to be an old problem, see here (from 2012):

http://cygwin.1069669.n5.nabble.com/kbhit-in-a-native-app-run-from-CYGWIN-console-does-not-work-td14287.html

@amit-traiana
Copy link

Sorry I can't supply more information. I moved a while ago to a full Linux setup.

@kyrylo kyrylo added the windows label Mar 21, 2020
@kyrylo kyrylo closed this as completed Mar 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants