fix: normalize quoted windows argv
This commit is contained in:
@@ -63,9 +63,10 @@ function normalizeWindowsArgv(argv: string[]): string[] {
|
|||||||
const execPath = process.execPath;
|
const execPath = process.execPath;
|
||||||
const execPathLower = execPath.toLowerCase();
|
const execPathLower = execPath.toLowerCase();
|
||||||
const execBase = path.basename(execPath).toLowerCase();
|
const execBase = path.basename(execPath).toLowerCase();
|
||||||
|
const normalizeArg = (value: string): string => value.replace(/^"+|"+$/g, "");
|
||||||
const isExecPath = (value: string | undefined): boolean => {
|
const isExecPath = (value: string | undefined): boolean => {
|
||||||
if (!value) return false;
|
if (!value) return false;
|
||||||
const lower = value.toLowerCase();
|
const lower = normalizeArg(value).toLowerCase();
|
||||||
return lower === execPathLower || path.basename(lower) === execBase;
|
return lower === execPathLower || path.basename(lower) === execBase;
|
||||||
};
|
};
|
||||||
const arg1 = path.basename(argv[1] ?? "").toLowerCase();
|
const arg1 = path.basename(argv[1] ?? "").toLowerCase();
|
||||||
|
|||||||
Reference in New Issue
Block a user