From fc51ad0441bb299b1be323cd90475d6fcd976cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ari=20Perkki=C3=B6?= Date: Mon, 23 Oct 2023 13:07:43 +0300 Subject: [PATCH] fix(cli): do not capture `stdin` when in run mode (#4310) --- packages/vitest/src/node/cli-api.ts | 2 +- packages/vitest/src/node/stdin.ts | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/vitest/src/node/cli-api.ts b/packages/vitest/src/node/cli-api.ts index d1d9f1702942..f9af6ffc5244 100644 --- a/packages/vitest/src/node/cli-api.ts +++ b/packages/vitest/src/node/cli-api.ts @@ -87,7 +87,7 @@ export async function startVitest( } let stdinCleanup - if (process.stdin.isTTY) + if (process.stdin.isTTY && ctx.config.watch) stdinCleanup = registerConsoleShortcuts(ctx) ctx.onServerRestart((reason) => { diff --git a/packages/vitest/src/node/stdin.ts b/packages/vitest/src/node/stdin.ts index e26a34ae69d2..636960092aa5 100644 --- a/packages/vitest/src/node/stdin.ts +++ b/packages/vitest/src/node/stdin.ts @@ -49,10 +49,6 @@ export function registerConsoleShortcuts(ctx: Vitest) { return } - // Other keys are for watch mode only - if (!ctx.config.watch) - return - const name = key?.name if (ctx.runningPromise) {