Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Explain cancellation better #225

Open
pke opened this issue Nov 1, 2019 · 0 comments
Open

Docs: Explain cancellation better #225

pke opened this issue Nov 1, 2019 · 0 comments

Comments

@pke
Copy link

@pke pke commented Nov 1, 2019

I still don't get how cancellation works with prompts.

try {
  await prompt({
    type: "input",
    message: "Test",
    name: "test"
  })
} catch (e) {
  console.error(e)
}

Pressing Ctrl+C will throw an empty String. How am I supposed to know that the prompt has been cancelled? Or to ask it differently, under which circumstance can the prompt throw too so I can distinguish between cancel (empty string) and other exceptions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.