style: format windows argv helpers

This commit is contained in:
Peter Steinberger
2026-01-19 14:19:26 +00:00
parent cb2add8459
commit ef352d4dc6
2 changed files with 4 additions and 2 deletions

View File

@@ -52,7 +52,8 @@ export async function runCli(argv: string[] = process.argv) {
function stripWindowsNodeExec(argv: string[]): string[] {
if (process.platform !== "win32") return argv;
const normalizeArg = (value: string): string => value.replace(/^"+|"+$/g, "");
const normalizeCandidate = (value: string): string => normalizeArg(value).replace(/^\\\\\\?\\/, "");
const normalizeCandidate = (value: string): string =>
normalizeArg(value).replace(/^\\\\\\?\\/, "");
const execPath = normalizeCandidate(process.execPath);
const execPathLower = execPath.toLowerCase();
const execBase = path.basename(execPath).toLowerCase();

View File

@@ -61,7 +61,8 @@ function normalizeWindowsArgv(argv: string[]): string[] {
if (process.platform !== "win32") return argv;
if (argv.length < 3) return argv;
const normalizeArg = (value: string): string => value.replace(/^"+|"+$/g, "");
const normalizeCandidate = (value: string): string => normalizeArg(value).replace(/^\\\\\\?\\/, "");
const normalizeCandidate = (value: string): string =>
normalizeArg(value).replace(/^\\\\\\?\\/, "");
const execPath = normalizeCandidate(process.execPath);
const execPathLower = execPath.toLowerCase();
const execBase = path.basename(execPath).toLowerCase();