I'm not exactly sure how a piped stdin differs from a terminal stdin, so I don't know how to fix this.
One step surely would be to change Cursor, so that it detects piped stdin, and switches to a NO-OP mode?
If this can't be fixed properly, the README should clearly state that using survey with piped stdin breaks the application.
This fixes restoring the state of the cursor when an error occurs when detecting terminal size. fixes #282
Piped stdin is still not handled correctly: The problem here is, that with piped stdin,
Cursor.Location()
fails withio.EOF
: https://github.com/AlecAivazis/survey/blob/f45c05b5039ca1f9c9c562be232f1c4044e0add0/terminal/cursor.go#L106-L109 Subsequently, no input is read, and control commands printed instead of being applied.I'm not exactly sure how a piped stdin differs from a terminal stdin, so I don't know how to fix this. One step surely would be to change
Cursor
, so that it detects piped stdin, and switches to a NO-OP mode?If this can't be fixed properly, the README should clearly state that using survey with piped stdin breaks the application.