This repository has been archived by the owner on Apr 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 358
Confirm with AskOne panics on command with yes piping #394
Labels
Comments
Thank you for reporting. Survey was not designed to take input from a stream that's not connected to a terminal, but I agree that we should avoid a panic and instead throw a more informative error message. Better yet, maybe Survey could work with any standard input stream, even if it's not a terminal. To avoid this in your app for now, you should check whether |
This was referenced Jan 6, 2023
+1 Getting the same error when running a command that uses survey, running from the shell of http://github.com/google/zx Zx is not a real terminal |
LucilleH
added a commit
to jetify-com/devbox
that referenced
this issue
Apr 5, 2023
## Summary Skip interactive survey if devbox is not executed in a terminal. When `devbox init` or `devbox generate direnv` is called in a dockerfile for example, we do not want to prompt for user input. I tried `echo 'y' | devbox generate direnv` or `yes | devbox generate direnv` or `devbox generate direnv <<< "y"`. None of them worked. Bug in the survey package: AlecAivazis/survey#394 ## How was it tested? devbox run build ./dist/devbox init (interactive mode) docker build -t devbox-cli . docker run --entrypoint=/bin/sh -ti devbox-cli (non interactive mode)
john-odonnell
added a commit
to cyberark/conjur-cli-go
that referenced
this issue
Apr 19, 2023
Being unable to pipe responses to prompts is a known shortcoming of Survey: AlecAivazis/survey#394. We frequently pipe 'yes' responses to CLI confirmation prompts, and this commit supports ONLY those cases.
13 tasks
john-odonnell
added a commit
to cyberark/conjur-cli-go
that referenced
this issue
Apr 19, 2023
Being unable to pipe responses to prompts is a known shortcoming of Survey: AlecAivazis/survey#394. We frequently pipe 'yes' responses to CLI confirmation prompts, and this commit supports ONLY those cases.
john-odonnell
added a commit
to cyberark/conjur-cli-go
that referenced
this issue
Apr 19, 2023
Being unable to pipe responses to prompts is a known shortcoming of Survey: AlecAivazis/survey#394. We frequently pipe 'yes' responses to CLI confirmation prompts, and this commit supports ONLY those cases.
john-odonnell
added a commit
to cyberark/conjur-cli-go
that referenced
this issue
Apr 19, 2023
Being unable to pipe responses to prompts is a known shortcoming of Survey: AlecAivazis/survey#394. We frequently pipe 'yes' responses to CLI confirmation prompts, and this commit supports ONLY those cases.
john-odonnell
added a commit
to cyberark/conjur-cli-go
that referenced
this issue
Apr 19, 2023
Being unable to pipe responses to prompts is a known shortcoming of Survey: AlecAivazis/survey#394. We frequently pipe 'yes' responses to CLI confirmation prompts, and this commit supports ONLY those cases.
john-odonnell
added a commit
to cyberark/conjur-cli-go
that referenced
this issue
Apr 19, 2023
Being unable to pipe responses to prompts is a known shortcoming of Survey: AlecAivazis/survey#394. We frequently pipe 'yes' responses to CLI confirmation prompts, and this commit supports ONLY those cases.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What operating system and terminal are you using? Linux
An example that showcases the bug.
Simple
yes
piping lead to a panic forsurvey.Confirm
andsurvey.AskOne
code. I have a cli-command which is asking yes-no on action confirmation. This is the code:It works well with an interactive input when I type yes or no. Bet when I use predefined answer like:
What did you expect to see?
Next execution output of the command.
What did you see instead?
I see panic. Top part of the stack:
The text was updated successfully, but these errors were encountered: