Bug#450717: libterm-readkey-perl: Call to ReadKey(0) is not blocking anymore

Niko Tyni ntyni at iki.fi
Sat Nov 10 19:08:44 UTC 2007


On Fri, Nov 09, 2007 at 04:41:22PM +0100, Michael Gebetsroither wrote:
> Package: libterm-readkey-perl
> Version: 2.30-3
> Severity: normal

> while (not defined ($x = ReadKey(0))) {}
> 
> The real problem is, that after starting start-x and returning, the cpu
> runs at 100% because ReadKey does not block anymore and returnes
> undefined value all of the time.

Hi,

the child process is probably setting O_NONBLOCK on STDIN.
Does it help if you do something like

 use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK);

 $flags = fcntl(STDIN, F_GETFL, 0)
 or die "Can't get flags for STDIN: $!\n";

 $flags = fcntl(STDIN, F_SETFL, $flags & ~O_NONBLOCK)
 or die "Can't set flags for STDIN: $!\n";

after the child process has returned?

Cheers,
-- 
Niko Tyni   ntyni at iki.fi





More information about the pkg-perl-maintainers mailing list