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

Try to avoid panicking in PosixParser if there's no /dev/tty. #8

Merged
merged 1 commit into from
Jul 1, 2023

Conversation

Verseth
Copy link

@Verseth Verseth commented Jul 1, 2023

See: c-bata#185


When using go-prompt before /dev/ is populated, it will panic() from NewStandardInputParser() because /dev/ isn't populated yet.

This will use stdin (fd 0) as a fallback if /dev/tty doesn't exist.

Furthermore GetWinSize() will return the default console size if the IOCTL call fails. This can happen if the default stdin is not a terminal, but a pipe as fixed in commit 846777c and described in issue c-bata#88.

When using go-prompt before /dev/ is populated, it will panic() from
NewStandardInputParser() because /dev/ isn't populated yet.

This will use stdin (fd 0) as a fallback if /dev/tty doesn't exist.

Furthermore GetWinSize() will return the default console size if the
IOCTL call fails. This can happen if the default stdin is not a
terminal, but a pipe as fixed in commit 846777c and described in
issue c-bata#88.
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

Successfully merging this pull request may close these issues.

None yet

2 participants