mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 09:11:26 +00:00
refactor(commands): share daemon runtime warning helper
This commit is contained in:
20
src/commands/daemon-install-runtime-warning.ts
Normal file
20
src/commands/daemon-install-runtime-warning.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { renderSystemNodeWarning, resolveSystemNodeInfo } from "../daemon/runtime-paths.js";
|
||||
|
||||
export type DaemonInstallWarnFn = (message: string, title?: string) => void;
|
||||
|
||||
export async function emitNodeRuntimeWarning(params: {
|
||||
env: Record<string, string | undefined>;
|
||||
runtime: string;
|
||||
nodeProgram?: string;
|
||||
warn?: DaemonInstallWarnFn;
|
||||
title: string;
|
||||
}): Promise<void> {
|
||||
if (params.runtime !== "node") {
|
||||
return;
|
||||
}
|
||||
const systemNode = await resolveSystemNodeInfo({ env: params.env });
|
||||
const warning = renderSystemNodeWarning(systemNode, params.nodeProgram);
|
||||
if (warning) {
|
||||
params.warn?.(warning, params.title);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user