jonathanstowe / TermReadKey

Character mode terminal access for Perl
12 stars 27 forks source link

Update ReadKey.xs to Improve Compatibility #37

Closed itsuki-hayashi closed 3 years ago

itsuki-hayashi commented 3 years ago

Update ReadKey.xs to improve compatibility for newer Perl versions. On newer Perl versions (tested on 5.32.1) the PerlIO_fileno does not return a usable fileno that can be used for GetConsoleScreenBufferInfo, which causes the following error messages:

Unable to get Terminal Size. The Win32 GetConsoleScreenBufferInfo call didn't work. The COLUMNS and LINES environment variables didn't work.

Fallback to GetStdHandle(STD_OUTPUT_HANDLE) will solve this issue.

I have tested this PR on Strawberry Perl 5.32.1 & Windows 10 20H2 x86-64.

jonathanstowe commented 3 years ago

Thanks!