fix(windows): accept ordinary drive path separators (#791)

This commit is contained in:
N0zoM1z0
2026-10-07 03:51:59 +08:00
committed by GitHub
parent d2aed172ab
commit b62931f833
8 changed files with 94 additions and 10 deletions
+10 -1
View File
@@ -141,7 +141,12 @@ export class GhidraHeadlessLauncher implements GhidraLauncher {
expectedCommand: null,
windowsVerbatimArguments: platform === "win32",
platform,
env: ghidraLaunchEnvironment(paths, this.options.javaHome, platform),
env: ghidraLaunchEnvironment(
paths,
this.options.javaHome,
platform,
command.command,
),
});
await writeGhidraRuntimeFile(
paths.ownershipPath,
@@ -382,6 +387,7 @@ const ghidraLaunchEnvironment = (
paths: ReturnType<typeof ghidraRuntimePaths>,
javaHome: string | undefined,
platform: NodeJS.Platform,
executable: string,
): NodeJS.ProcessEnv => {
return {
...ghidraJavaEnvironment(javaHome, process.env, platform),
@@ -390,6 +396,9 @@ const ghidraLaunchEnvironment = (
TMPDIR: paths.tempRoot,
...(platform === "win32"
? {
// Batch FOR /F launches another command interpreter through ComSpec.
// Use the same executable with the spelling consumed by cmd.exe.
ComSpec: executable.replaceAll("/", "\\"),
USERPROFILE: paths.homeRoot,
APPDATA: paths.configRoot,
LOCALAPPDATA: paths.cacheRoot,
+3 -1
View File
@@ -62,7 +62,9 @@ export class WindowsOwnedProcess extends EventEmitter {
.filter((entry): entry is [string, string] => entry[1] !== undefined)
.map(([key, value]) => `${key}=${value}`);
const line = [
quoteWindowsProcessArgument(command),
// cmd.exe parses its own command line rather than the CRT argv rules;
// its executable token must match the native drive-path representation.
quoteWindowsProcessArgument(command.replaceAll("/", "\\")),
...arguments_.map((value) =>
verbatim ? value : quoteWindowsProcessArgument(value),
),