chzyer / readline

Readline is a pure go(golang) implementation for GNU-Readline kind library
MIT License
2.06k stars 273 forks source link

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

Open rhettli opened 3 years ago

rhettli commented 3 years ago

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.

GwynethLlewelyn commented 2 years ago

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

Silthus commented 1 year ago

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?

johnjqc commented 1 year ago

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

mamh2021 commented 7 months ago

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.