fix(coding-agent): exit after package commands

closes #5687
This commit is contained in:
Armin Ronacher
2026-06-14 10:52:31 +02:00
parent f0989800cb
commit 11b5403fad
3 changed files with 11 additions and 0 deletions

View File

@@ -37,12 +37,21 @@ describe("package commands", () => {
originalExitCode = process.exitCode;
originalExecPath = process.execPath;
process.exitCode = undefined;
vi.spyOn(process, "exit").mockImplementation(((code?: string | number | null) => {
if (code === undefined || code === null || Number(code) === 0) {
process.exitCode = undefined;
} else {
process.exitCode = code;
}
return undefined as never;
}) as typeof process.exit);
process.env[ENV_AGENT_DIR] = agentDir;
process.chdir(projectDir);
});
afterEach(() => {
vi.unstubAllGlobals();
vi.restoreAllMocks();
process.chdir(originalCwd);
process.exitCode = originalExitCode;
if (originalAgentDir === undefined) {