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

ReadKey -1 is blocking (ActiveState/Windows7) #28

Closed
Theemim opened this issue Jul 3, 2017 · 2 comments
Closed

ReadKey -1 is blocking (ActiveState/Windows7) #28

Theemim opened this issue Jul 3, 2017 · 2 comments

Comments

@Theemim
Copy link

Theemim commented Jul 3, 2017

On this system:

  • ActiveState 5.24.1.2402 (x86) - fresh install, packages updated
  • TermReadKey 2.37
  • 64-bit Windows 7 Pro

I am seeing ReadKey(-1) block until a key is pressed. Ideas? Thank you.

use strict;
use warnings;
use Term::ReadKey;

$|=1;
print("\nStarting ReadKey blocking test.  Do not hit a key...\n");
testReadKey(1);   # ReadKey times out and returns undef as expected
testReadKey(-1);  # ReadKey blocks until a key is pressed
print("\nTest complete\n");

sub testReadKey {
  my $readKeyArg = shift;
  print("\nTesting \$key=ReadKey($readKeyArg) : ");
  ReadMode(4);
  my $key = ReadKey($readKeyArg);
  ReadMode(0);
  if(not defined $key) {
    print("\$key is undefined, test passed\n");
  }
  else {
    print("\$key is defined, test failed\n");
  }
}
@amba
Copy link
Contributor

amba commented Jul 3, 2017

Hey Theemim,
This might be related to recent issue #25.
The fix for this is not yet on CPAN.
In our case the workaround is to use the older 2.30 CPAN release.

@jonathanstowe
Copy link
Owner

I'm going to close this now as I am unable to reproduce. Please re-open with a PR if this is still problem.

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