Skip to content

Commit

Permalink
fix(core): should not print extra logs when press Ctrl+C (#4661)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Sep 15, 2023
1 parent bc1413d commit 4b8cdd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/four-beds-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@modern-js/core': patch
---

fix(core): should not print extra logs when press Ctrl+C

fix(core): 修复按下 press Ctrl+C 时会打印多余日志的问题
5 changes: 4 additions & 1 deletion packages/cli/core/src/createCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ export const createCli = () => {
hooksRunner.beforeExit();
if (err instanceof Error) {
logger.error(err.stack);
} else {
} else if (
err &&
(event === 'unhandledRejection' || event === 'uncaughtException')
) {
// We should not pass it, if err is not instanceof Error.
// We can use `console.trace` to follow it call stack,
console.trace('Unknown Error', err);
Expand Down

0 comments on commit 4b8cdd3

Please sign in to comment.