Skip to content

Commit e7e4539

Browse files
committed
fix: narrow exit 130 to doctor-prompter path only
Revert guardCancel to exit 0 by default (matching main) and pass exit code 130 only from doctor-prompter where the installer needs to distinguish user cancellation from normal failures. This preserves the existing cancellation behavior for configure, wizard, gateway, and daemon prompts while keeping the SIGINT convention for the installer's doctor subprocess. Signed-off-by: Sebastien Tardif <[email protected]>
1 parent 8e5cb42 commit e7e4539

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/commands/doctor-prompter.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,15 @@ export function createDoctorPrompter(params: {
4747
if (!repairMode.canPrompt) {
4848
return p.initialValue ?? false;
4949
}
50+
// Exit 130 (SIGINT convention) so the installer can distinguish
51+
// user cancellation from normal doctor failures.
5052
return guardCancel(
5153
await confirm({
5254
...p,
5355
message: stylePromptMessage(p.message),
5456
}),
5557
params.runtime,
58+
130,
5659
);
5760
};
5861

@@ -78,6 +81,7 @@ export function createDoctorPrompter(params: {
7881
message: stylePromptMessage(p.message),
7982
}),
8083
params.runtime,
84+
130,
8185
);
8286
},
8387
confirmRuntimeRepair: async (p) => {
@@ -103,6 +107,7 @@ export function createDoctorPrompter(params: {
103107
message: stylePromptMessage(confirmParams.message),
104108
}),
105109
params.runtime,
110+
130,
106111
);
107112
},
108113
select: async <T>(p: Parameters<typeof select>[0], fallback: T) => {
@@ -118,6 +123,7 @@ export function createDoctorPrompter(params: {
118123
),
119124
}),
120125
params.runtime,
126+
130,
121127
) as T;
122128
},
123129
shouldRepair: repairMode.shouldRepair,

src/commands/onboard-helpers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ export { detectBinary };
4747
export { detectBrowserOpenSupport, openUrl, resolveBrowserOpenCommand };
4848
export { resolveAdvertisedControlUiLinks, resolveControlUiLinks, resolveLocalControlUiProbeLinks };
4949

50-
/** Handles Clack cancellation by exiting with SIGINT convention (130). */
51-
export function guardCancel<T>(value: T | symbol, runtime: RuntimeEnv): T {
50+
/** Handles Clack cancellation by exiting through the runtime. */
51+
export function guardCancel<T>(value: T | symbol, runtime: RuntimeEnv, exitCode = 0): T {
5252
if (isCancel(value)) {
5353
cancel(stylePromptTitle("Setup cancelled.") ?? "Setup cancelled.");
54-
runtime.exit(130);
54+
runtime.exit(exitCode);
5555
throw new Error("unreachable");
5656
}
5757
return value;

0 commit comments

Comments
 (0)