mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-29 02:38:38 +00:00
fix(cli): keep json preflight stdout machine-readable
This commit is contained in:
@@ -39,14 +39,27 @@ async function getConfigSnapshot() {
|
||||
export async function ensureConfigReady(params: {
|
||||
runtime: RuntimeEnv;
|
||||
commandPath?: string[];
|
||||
suppressDoctorStdout?: boolean;
|
||||
}): Promise<void> {
|
||||
const commandPath = params.commandPath ?? [];
|
||||
if (!didRunDoctorConfigFlow && shouldMigrateStateFromPath(commandPath)) {
|
||||
didRunDoctorConfigFlow = true;
|
||||
await loadAndMaybeMigrateDoctorConfig({
|
||||
options: { nonInteractive: true },
|
||||
confirm: async () => false,
|
||||
});
|
||||
const runDoctorConfigFlow = async () =>
|
||||
loadAndMaybeMigrateDoctorConfig({
|
||||
options: { nonInteractive: true },
|
||||
confirm: async () => false,
|
||||
});
|
||||
if (!params.suppressDoctorStdout) {
|
||||
await runDoctorConfigFlow();
|
||||
} else {
|
||||
const originalStdoutWrite = process.stdout.write;
|
||||
process.stdout.write = ((() => true) as unknown) as typeof process.stdout.write;
|
||||
try {
|
||||
await runDoctorConfigFlow();
|
||||
} finally {
|
||||
process.stdout.write = originalStdoutWrite;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const snapshot = await getConfigSnapshot();
|
||||
|
||||
Reference in New Issue
Block a user