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

bug: CTRL+C when scaffolding into an existing directory doesn't exit #1597

Open
c-ehrlich opened this issue Oct 16, 2023 · 3 comments
Open
Labels
📌 area: cli Relates to the CLI 🐞 confirmed bug Something isn't working

Comments

@c-ehrlich
Copy link
Member

c-ehrlich commented Oct 16, 2023

Provide environment information

7.22.0

Describe the bug

I pressed CTRL+C in response to each of the prompts in the screenshot below. iTerm2 on MacOS.

CleanShot 2023-10-16 at 10 34 26@2x

CTRL+C in "Warning: already exists and isn't empty. How would you like to proceed?" => picks override
CTRL+C in "Are you sure you want to overwrite conflicting files?" => picks yes
CTRL+C in "Warning: Git is already initialized in "". Initializing a new git repository
would delete the previous history. Would you like to continue anyways?" => picks yes

expected behaviour: CTRL+C at any of these points exits the CLI without scaffolding anything

Reproduction repo

To reproduce

  • initialize an app into some directory
  • initialize into the same directory again
  • press CTRL+C when asked about existing files etc

Additional information

No response

@hodeinavarro
Copy link

I can confirm this bug as of today (2023-10-19) in next branch.

The issue is because clack prompt can return either a string or a symbol to inform about the user cancelling the prompt and the symbol is not being considered at all.

clack exports an useful function called isCancel which is exactly what we need here.

I can submit a PR but I have doubts with the last step.

CTRL+C in "Warning: Git is already initialized in "". Initializing a new git repository
would delete the previous history. Would you like to continue anyways?" => picks yes

Doing a cancel here would only stop git being initialized, instead of stopping the scaffold as @c-ehrlich mentioned which I think is fine but would love to read other opinions.

@c-ehrlich
Copy link
Member Author

IMO if the user exits the CLI before making all decisions, nothing should happen. @juliusmarminge thoughts?

@juliusmarminge
Copy link
Member

ctrl+c should cancel the CLI entirely i feel like?

whether it exits with 0 or non 0 exit code idk

@juliusmarminge juliusmarminge added 🐞 confirmed bug Something isn't working 📌 area: cli Relates to the CLI and removed 🐞❔ unconfirmed bug labels Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📌 area: cli Relates to the CLI 🐞 confirmed bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants