mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-04-28 03:49:31 +00:00
fix(cli): exit with code 1 on spawn fix error paths (#2781)
cmdFix error paths (spawn not found, non-interactive with multiple servers, picker mismatch) previously returned without setting a non-zero exit code. Scripts checking $? would incorrectly see success. Now exits with code 1 on all error paths in cmdFix. fixSpawn() is unchanged since it is also called from the list picker where returning to loop is correct behavior. Agent: ux-engineer Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
15a62a9ad0
commit
d9575acd43
2 changed files with 5 additions and 4 deletions
|
|
@ -412,8 +412,9 @@ describe("cmdFix", () => {
|
|||
await loadManifest(true);
|
||||
global.fetch = savedFetch;
|
||||
|
||||
await cmdFix("nonexistent-id");
|
||||
await expect(cmdFix("nonexistent-id")).rejects.toThrow("process.exit");
|
||||
|
||||
expect(processExitSpy).toHaveBeenCalledWith(1);
|
||||
expect(clack.logError).toHaveBeenCalledWith(expect.stringContaining("not found"));
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ export async function cmdFix(spawnId?: string, options?: FixOptions): Promise<vo
|
|||
if (!record) {
|
||||
p.log.error(`Spawn not found: ${pc.bold(spawnId)}`);
|
||||
p.log.info(`Run ${pc.cyan("spawn list")} to see your active spawns.`);
|
||||
return;
|
||||
process.exit(1);
|
||||
}
|
||||
await fixSpawn(record, manifest, options);
|
||||
return;
|
||||
|
|
@ -242,7 +242,7 @@ export async function cmdFix(spawnId?: string, options?: FixOptions): Promise<vo
|
|||
if (!isInteractiveTTY()) {
|
||||
p.log.error("spawn fix requires an interactive terminal or a spawn name/ID.");
|
||||
p.log.info(`Usage: ${pc.cyan("spawn fix <spawn-id>")}`);
|
||||
return;
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Interactive picker: show active servers and let user choose
|
||||
|
|
@ -264,7 +264,7 @@ export async function cmdFix(spawnId?: string, options?: FixOptions): Promise<vo
|
|||
const record = servers.find((r) => (r.id || r.timestamp) === selected);
|
||||
if (!record) {
|
||||
p.log.error("Spawn not found.");
|
||||
return;
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
await fixSpawn(record, manifest, options);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue