mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-17 20:21:13 +00:00
refactor: dedupe cli lowercase helpers
This commit is contained in:
@@ -6,6 +6,7 @@ import type {
|
||||
UpdateStepProgress,
|
||||
} from "../../infra/update-runner.js";
|
||||
import { defaultRuntime } from "../../runtime.js";
|
||||
import { normalizeLowercaseStringOrEmpty } from "../../shared/string-coerce.js";
|
||||
import { theme } from "../../terminal/theme.js";
|
||||
import type { UpdateCommandOptions } from "./shared.js";
|
||||
|
||||
@@ -72,7 +73,7 @@ export function inferUpdateFailureHints(result: UpdateRunResult): string[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
const stderr = (failedStep.stderrTail ?? "").toLowerCase();
|
||||
const stderr = normalizeLowercaseStringOrEmpty(failedStep.stderrTail);
|
||||
const hints: string[] = [];
|
||||
|
||||
if (failedStep.name.startsWith("global update") && stderr.includes("eacces")) {
|
||||
|
||||
@@ -19,6 +19,7 @@ import {
|
||||
import type { UpdateStepProgress, UpdateStepResult } from "../../infra/update-runner.js";
|
||||
import { runCommandWithTimeout } from "../../process/exec.js";
|
||||
import { defaultRuntime } from "../../runtime.js";
|
||||
import { normalizeLowercaseStringOrEmpty } from "../../shared/string-coerce.js";
|
||||
import { theme } from "../../terminal/theme.js";
|
||||
import { pathExists } from "../../utils.js";
|
||||
|
||||
@@ -129,7 +130,7 @@ function resolveDefaultGitDir(): string {
|
||||
}
|
||||
|
||||
export function resolveNodeRunner(): string {
|
||||
const base = path.basename(process.execPath).toLowerCase();
|
||||
const base = normalizeLowercaseStringOrEmpty(path.basename(process.execPath));
|
||||
if (base === "node" || base === "node.exe") {
|
||||
return process.execPath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user