refactor: dedupe cli lowercase helpers

This commit is contained in:
Peter Steinberger
2026-04-07 17:35:58 +01:00
parent cebfa70277
commit 1a3f141215
28 changed files with 96 additions and 63 deletions

View File

@@ -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")) {

View File

@@ -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;
}