go-prompt icon indicating copy to clipboard operation
go-prompt copied to clipboard

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

Open abrander opened this issue 4 years ago • 4 comments

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.

abrander avatar Aug 14 '20 13:08 abrander

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

abrander avatar Aug 17 '20 08:08 abrander

@abrander @c-bata any updates on this?

pgollangi avatar Dec 30 '22 12:12 pgollangi

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

trantaiBD avatar Aug 23 '23 09:08 trantaiBD

@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: https://github.com/elk-language/go-prompt/pull/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

Verseth avatar Aug 23 '23 10:08 Verseth