Files
openclaw/src/commands/onboard-interactive.ts
Vincent Koc a042b32d2f fix: Docker installation keeps hanging on MacOS (#12972)
* Onboarding: avoid stdin resume after wizard finish

* Changelog: remove Docker hang entry from PR

* Terminal: make stdin resume behavior explicit at call sites

* CI: rerun format check

* Onboarding: restore terminal before cancel exit

* test(onboard): align restoreTerminalState expectation

* chore(format): align onboarding restore test with updated oxfmt config

* chore(format): enforce updated oxfmt on restore test

* chore(format): apply updated oxfmt spacing to restore test

* fix: avoid stdin resume after onboarding (#12972) (thanks @vincentkoc)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-02-14 19:46:07 +01:00

32 lines
1.1 KiB
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();
let exitCode: number | null = null;
try {
await runOnboardingWizard(opts, runtime, prompter);
} catch (err) {
if (err instanceof WizardCancelledError) {
// Best practice: cancellation is not a successful completion.
exitCode = 1;
return;
}
throw err;
} finally {
// Keep stdin paused so non-daemon runs can exit cleanly (e.g. Docker setup).
restoreTerminalState("onboarding finish", { resumeStdin: false });
if (exitCode !== null) {
runtime.exit(exitCode);
}
}
}