mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 07:11:25 +00:00
* fix(cli): exit with non-zero code when configure/agents-add wizards are cancelled Follow-up to the onboard cancel fix. The configure wizard and agents add wizard also caught WizardCancelledError and exited with code 0, which signals success to callers. Change to exit(1) for consistency — user cancellation is not a successful completion. This ensures scripts that chain these commands with set -e will correctly stop when the user cancels. * fix(cli): make wizard cancellations exit non-zero (#14156) (thanks @0xRaini) --------- Co-authored-by: Rain <rain@Rains-MBA-M4.local> Co-authored-by: Sebastian <19554889+sebslight@users.noreply.github.com>
26 lines
822 B
TypeScript
26 lines
822 B
TypeScript
import type { RuntimeEnv } from "../runtime.js";
|
|
import type { OnboardOptions } from "./onboard-types.js";
|
|
import { defaultRuntime } from "../runtime.js";
|
|
import { restoreTerminalState } from "../terminal/restore.js";
|
|
import { createClackPrompter } from "../wizard/clack-prompter.js";
|
|
import { runOnboardingWizard } from "../wizard/onboarding.js";
|
|
import { WizardCancelledError } from "../wizard/prompts.js";
|
|
|
|
export async function runInteractiveOnboarding(
|
|
opts: OnboardOptions,
|
|
runtime: RuntimeEnv = defaultRuntime,
|
|
) {
|
|
const prompter = createClackPrompter();
|
|
try {
|
|
await runOnboardingWizard(opts, runtime, prompter);
|
|
} catch (err) {
|
|
if (err instanceof WizardCancelledError) {
|
|
runtime.exit(1);
|
|
return;
|
|
}
|
|
throw err;
|
|
} finally {
|
|
restoreTerminalState("onboarding finish");
|
|
}
|
|
}
|