Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Readline doesn't working on Windows #86

Open
gugglegum opened this issue Sep 21, 2018 · 4 comments
Open

Readline doesn't working on Windows #86

gugglegum opened this issue Sep 21, 2018 · 4 comments

Comments

@gugglegum
Copy link

The "Basic usage" example of Readline in official manual called Hack book of Hoa\Console doesn't working as expected. Here's this example:

$rl = new Hoa\Console\Readline\Readline();

do {
    $line = $rl->readLine('> ');
    echo '< ', $line, "\n\n";
} while (false !== $line && 'quit' !== $line);

It works fine on Linux. But on Windows (tested on 7 and 10) it doesn't prints a readline prompt prior user input. It prints it after user enter something end pressed Enter. I.e. user should enter some answer and only afterwards can see the question.

Additionally this script do not reacts on "quit" command because on Windows readline() returns user input with CR (ASCII 0x0D) symbol at the end.

Due to this issue this library cannot be used as universal cross-platform solution for console interaction with user.

@Hywan
Copy link
Member

Hywan commented Sep 26, 2018

Thanks for the report!

What version of Windows or terminal are you using please?

@Hywan Hywan self-assigned this Sep 26, 2018
@Hywan Hywan added in progress and removed ready labels Sep 26, 2018
@gugglegum
Copy link
Author

@Hywan Windows 7 and Windows 10 affected for sure.

@Hywan
Copy link
Member

Hywan commented Sep 26, 2018

And what terminal are you using :-)?

@gugglegum
Copy link
Author

@Hywan I use default terminal. DOS box? Cmd.exe based.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants