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

open_keyboard on Windows does not receive_line until next keypress #350

Open
dymk opened this issue Aug 3, 2012 · 2 comments
Open

open_keyboard on Windows does not receive_line until next keypress #350

dymk opened this issue Aug 3, 2012 · 2 comments

Comments

@dymk
Copy link

dymk commented Aug 3, 2012

Take this example EM application:

require 'eventmachine'

module KeyboardHandler
  include EM::Protocols::LineText2
  def prompt
    print "> "
  end
  def post_init
    prompt
  end

  def receive_line data
    puts "Got #{data}"
    prompt
  end
end

EM.run {
  EM.open_keyboard KeyboardHandler
}

When run on a *nix machine, it will function as expected, with the entered data being echo'd back to the user after each return key press.
However, on Windows (testing on Win7 x64 Professional), entering a string to the console and pressing return will result in the application pausing, until the user presses another key (such as space or backspace). Note that Ruby can indeed read lines from STDIN correctly on Windows, that can be tested with this snippet:

print "> "
while data = STDIN.readline
  puts "#{data}"
  print "> "
end
@chris-teague
Copy link

I've also experienced this issue on both Windows 7 x64 Professional and Windows XP Professional. Dropping back to 1.0.0.rc.2 appears to be a quick fix for the time being.

edit: actually, in further testing this still seems to be existing in rc.1 & rc.2

@cs96and
Copy link

cs96and commented Aug 10, 2016

I've just started using EventMachine and I'm having this problem with v1.2.0.1. This bug report is 4 years old. Are there any plans to fix it?

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