-
-
Notifications
You must be signed in to change notification settings - Fork 27
fix: exit gracefully when press ctrl + c
#189
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
base: main
Are you sure you want to change the base?
Conversation
Hi @hyperz111!, thanks for the Pull Request The pull request title isn't properly formatted. We ask that you update the pull request title to match this format, as we use it to generate changelogs and automate releases.
To Fix: You can fix this problem by clicking 'Edit' next to the pull request title at the top of this page. Read more about contributing to ESLint here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR improves the user experience of ESLint's configuration generator by implementing graceful exit handling for Ctrl+C interruptions and updating the visual styling of prompts and logging.
- Adds colored symbols and improved visual feedback for different types of log messages
- Updates prompt styling with consistent colors and symbols for better visual hierarchy
- Modifies logging utility functions to include colored symbols and consistent formatting
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
File | Description |
---|---|
package.json | Adds ansi-colors dependency for terminal color support |
lib/utils/logging.js | Refactors logging functions to include colored symbols and adds new log/success functions |
lib/questions.js | Implements prompt styling with colors and symbols via setQuestionsPromptStyle function |
lib/config-generator.js | Updates log function calls to use new success function for positive outcomes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Thanks for the pull request. Can you please give us more detail about what you changed and why? |
When we do @eslint/create-config: v1.9.0
✖ What do you want to lint? · No items were selected
node:internal/readline/interface:568
throw new ERR_USE_AFTER_CLOSE('readline');
^
Error [ERR_USE_AFTER_CLOSE]: readline was closed
at Interface.pause (node:internal/readline/interface:568:13)
at MultiSelect.off [as stop] (/data/data/com.termux/files/home/.npm/_npx/abe235584debfe0e/node_modules/enquirer/lib/keypress.js:217:8)
at Object.onceWrapper (node:events:622:28)
at MultiSelect.emit (node:events:520:35)
at prompt.emit (/data/data/com.termux/files/home/.npm/_npx/abe235584debfe0e/node_modules/enquirer/index.js:128:14)
at MultiSelect.close (/data/data/com.termux/files/home/.npm/_npx/abe235584debfe0e/node_modules/enquirer/lib/prompt.js:182:10)
at MultiSelect.cancel (/data/data/com.termux/files/home/.npm/_npx/abe235584debfe0e/node_modules/enquirer/lib/prompt.js:161:16)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async MultiSelect.keypress (/data/data/com.termux/files/home/.npm/_npx/abe235584debfe0e/node_modules/enquirer/lib/prompt.js:46:14) {
code: 'ERR_USE_AFTER_CLOSE'
}
Node.js v24.6.0 In this change, this would be: @eslint/create-config: v1.10.0
✖ What do you want to lint? · No items were selected
✖ Operation Cancelled. |
Got it, thanks for explaining. In order to keep this PR focused, can you remove the changes that don't relate that? |
ctrl + c
We probably want to catch SIGINT and SIGTERM, like in this post: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, could we add a brief test to check whether SIGINT and SIGTERM work as expected?
But when we do Error [ERR_USE_AFTER_CLOSE]: readline was closed See this |
@nzakas, this is OK? |
Prerequisites checklist
What is the purpose of this pull request?
In this PR, i make the prompt is handle
ctrl + c
gracefully.What changes did you make? (Give an overview)
When we do
ctrl + c
:In this change, this would be:
Related Issues
N/A
Is there anything you'd like reviewers to focus on?
N/A