fix(ghidra): keep JVM warnings out of LaunchSupport output (#1698)

* fix(ghidra): keep JVM warnings out of LaunchSupport output

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ghidra): retain LaunchSupport warnings in session diagnostics

* fix(ghidra): select helper logging flags by observed JVM identity

* fix(ghidra): preserve diagnostics through typed failure projection

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
Petru101
2026-10-13 02:46:00 +08:00
committed by GitHub
co-authored by Claude Opus 5.5 morluto
parent 0043d9b134
commit e20994a8ea
15 changed files with 646 additions and 84 deletions
+11
View File
@@ -7,11 +7,13 @@ export const ghidraJavaLaunch = async (options: {
readonly platform: NodeJS.Platform;
readonly analyzeHeadlessPath: string;
readonly javaHome: string;
readonly javaVmName?: string;
readonly homeRoot: string;
readonly tempRoot: string;
readonly arguments: readonly string[];
readonly environment: NodeJS.ProcessEnv;
readonly signal?: AbortSignal;
readonly onStderr: (mode: "-envvars" | "-vmargs", stderr: string) => void;
}): Promise<{
readonly command: string;
readonly arguments: readonly string[];
@@ -26,6 +28,13 @@ export const ghidraJavaLaunch = async (options: {
];
const supportArguments = [
...isolatedProperties,
// Only identified HotSpot VMs have these unified-logging semantics. OpenJ9
// uses different -Xlog behavior; missing VM identity must stay unknown.
...(/^(?:OpenJDK|Java HotSpot\(TM\)) (?:64-Bit )?(?:Server|Client|Zero) VM$/u.test(
options.javaVmName ?? "",
)
? ["-Xlog:disable", "-Xlog:all=warning:stderr"]
: []),
"-cp",
join(supportRoot, "LaunchSupport.jar"),
"LaunchSupport",
@@ -42,6 +51,7 @@ export const ghidraJavaLaunch = async (options: {
...(options.signal === undefined ? {} : { signal: options.signal }),
},
);
options.onStderr("-envvars", configuredEnvironment.stderr);
for (const line of configuredEnvironment.stdout.split(/\r?\n/u)) {
if (line === "") continue;
const separator = line.indexOf("=");
@@ -63,6 +73,7 @@ export const ghidraJavaLaunch = async (options: {
...(options.signal === undefined ? {} : { signal: options.signal }),
},
);
options.onStderr("-vmargs", configuredArguments.stderr);
const vmArguments = configuredArguments.stdout
.split(/\r?\n/u)
.filter((line) => line !== "");