We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 0c0ccce + 7f75591 commit a0e6efbCopy full SHA for a0e6efb
1 file changed
packages/cli/src/cli.ts
@@ -193,8 +193,12 @@ if (!isHelp && !hasJsonFlag && command !== "upgrade") {
193
const commandStart = Date.now();
194
let commandFailed = false;
195
196
-// Async flush for normal exit (beforeExit fires when the event loop drains)
197
-process.on("beforeExit", () => {
+// Async flush for normal exit. `beforeExit` re-fires every time the
+// event loop drains, and the async `_flush()` itself schedules new
198
+// work — so a plain `on` listener would print the update notice (and
199
+// re-flush) once per drain (the user-reported double-print). `once`
200
+// detaches after first invocation, which is what we want for both.
201
+process.once("beforeExit", () => {
202
_flush?.().catch(() => {});
203
if (!hasJsonFlag) _printUpdateNotice?.();
204
});
0 commit comments