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

[DIT-6379] Fix terminal hanging when Ctrl + C pressed during pull and token prompt #105

Conversation

azjgard
Copy link
Collaborator

@azjgard azjgard commented Mar 22, 2024

Overview

Fixes an issue where the CLI would become unresponsive but fail to fully exit when the user attempted to use Ctrl + C to bail out of the process.

Context

https://linear.app/dittowords/issue/DIT-6379/fix-cli-hanging-when-ctrlc-out-of-token-collection-prompt

Test Plan

  1. Remove the file ~/.config/ditto
  2. Run yarn start pull
  3. At the prompt, hit Ctrl + C
  4. Confirm that the CLI exits and control is immediately returned to the user

@@ -1,4 +1,4 @@
export function quit(message: string | null, exitCode = 2) {
if (message) console.log(`\n${message}\n`);
process.exitCode = exitCode;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was incorrect - setting the exit code ensured that when the process exited of other means, it would have the specified status, but the intent of the quit() function in all instances of usage is to immediately terminate the running process.

Copy link
Contributor

@jaerod95 jaerod95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the exit functionality, everything seems to be working as expected

@azjgard azjgard merged commit 0932396 into master Mar 22, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants