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 #185

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

abrander
Copy link

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

This will use stdin (file descriptor 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 #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.
@abrander
Copy link
Author

abrander commented Aug 17, 2020

This will enable us to close the following issues if merged:

#39 runtime error : integer divided by zero. Facing this issue when I am trying to run go-prompt as a docker container
#71 Panic while debugging using VSCODE linux
#154 [Bug] When starting docker image with CMD it panics

@pgollangi
Copy link
Contributor

@abrander @c-bata any updates on this?

@trantaiBD
Copy link

hi @c-bata when this MR could be merged? Thanks!

@Verseth
Copy link

Verseth commented Aug 23, 2023

@trantaiBD Unfortunately no one has been maintaining it for the last 2/3 years.

I've created a fork and merged lots of PRs from this repo.
I've addressed this issue and merged this PR in my fork: elk-language#8.

There's lots of new functionalities like customisable syntax highlighting, multiline editing, customisable automatic indentation.

I use it to build a REPL for my programming language, but I want to maintain it as an independent library.

https://github.com/elk-language/go-prompt

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

4 participants