fix(coding-agent): repair self-update detection

Fixes #3942
Fixes #3980
Fixes #3922
This commit is contained in:
Armin Ronacher
2026-04-30 19:10:06 +02:00
parent def47ece92
commit ade08de14c
6 changed files with 349 additions and 117 deletions

View File

@@ -1,7 +1,16 @@
import type { ChildProcess } from "node:child_process";
import { basename } from "node:path";
const EXIT_STDIO_GRACE_MS = 100;
const WINDOWS_SHELL_COMMANDS = new Set(["npm", "npx", "pnpm", "yarn", "yarnpkg", "corepack"]);
export function shouldUseWindowsShell(command: string): boolean {
if (process.platform !== "win32") return false;
const commandName = basename(command).toLowerCase();
return commandName.endsWith(".cmd") || commandName.endsWith(".bat") || WINDOWS_SHELL_COMMANDS.has(commandName);
}
/**
* Wait for a child process to terminate without hanging on inherited stdio handles.
*