readline icon indicating copy to clipboard operation
readline copied to clipboard

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

Open rhettli opened this issue 4 years ago • 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.

rhettli avatar Mar 02 '21 13:03 rhettli

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...

GwynethLlewelyn avatar Nov 06 '21 20:11 GwynethLlewelyn

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?

Silthus avatar Aug 04 '22 08:08 Silthus

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 https://github.com/crossterm-rs/crossterm/issues/168

johnjqc avatar May 19 '23 00:05 johnjqc

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.

mamh2021 avatar Nov 23 '23 22:11 mamh2021