chzyer/readline

it will return an EOF error when run with git bash on windows

rhettli opened this issue · 4 comments

1.The go code:

	rl, err := readline.New("> ")
	if err != nil {
		fmt.Println("ERROR:",err)
		return
	}

	defer rl.Close()
	if str, err := rl.Readline(); err == nil {
		fmt.Println(str)
	}else {
		fmt.Println("err:",err)  // got a error here when program started
	}

2.The error bellow:

image

3. Are there some skill to fix it? thx.

In your code above, you're just reading a single line — and stopping. As a consequence, you'll get a EOF, which is exactly what the package returns that.

I'm quite sure you forgot to enclose everything inside a for {...} loop...

I have the same issue using https://github.com/manifoldco/promptui/ and it fails immediately with an EOF when using Git Bash. All other operations succeed.

Any idea how to workaround or fix it?

I have the same problem, but if I run git bash from visual studio code, it works fine.

image

Is not a bug of this library, I found it crossterm-rs/crossterm#168

I have the same problem, I have the same issue using https://github.com/manifoldco/promptui/ .

but if I run git bash from idea/vscode, it works fine.