AlecAivazis / survey

A golang library for building interactive and accessible prompts with full support for windows and posix terminals.
MIT License
4.08k stars 351 forks source link

When .Ask fails, the terminal state isn’t restored #282

Closed skitt closed 3 years ago

skitt commented 4 years ago

When survey is used with no input, it fails (EOF) and leaves the terminal as-is, with the cursor in the bottom-right-hand corner and hidden.

Reproducer:

package main

import (
    "github.com/AlecAivazis/survey/v2"
)

func main() {
    cont := false
    survey.AskOne(&survey.Confirm{
        Message: "Do you want to continue?",
    }, &cont)
}

Run as ./surveydemo < /dev/null.