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:
co-authored by
Claude Opus 5.5
morluto
parent
0043d9b134
commit
e20994a8ea
@@ -2,13 +2,15 @@ import type { AnalysisError } from "../domain/analysisErrorBase.js";
|
||||
import type { JsonValue } from "../domain/jsonValue.js";
|
||||
import { DarwinProcessOwnershipInspectionError } from "../process/DarwinProcessRunTokenReader.js";
|
||||
import { boundedUtf8Text } from "../process/boundedUtf8Text.js";
|
||||
import { GhidraLaunchError } from "./GhidraLauncher.js";
|
||||
import {
|
||||
GhidraLaunchError,
|
||||
GHIDRA_LAUNCH_COMMAND_OUTPUT_BYTES,
|
||||
} from "./GhidraLauncher.js";
|
||||
|
||||
const MAX_CAUSE_DEPTH = 3;
|
||||
const MAX_CAUSE_MESSAGE_BYTES = 2 * 1024;
|
||||
const MAX_CAUSE_FIELD_BYTES = 1024;
|
||||
const MAX_COMPILER_STDERR_BYTES = 8 * 1024;
|
||||
const MAX_LAUNCH_COMMAND_OUTPUT_BYTES = 8 * 1024;
|
||||
|
||||
/** Stable failure phase for one private Ghidra headless session. */
|
||||
export type GhidraSessionFailureKind =
|
||||
@@ -229,18 +231,28 @@ const causeLaunchOutcome = (
|
||||
redact: (value: string) => string,
|
||||
): Record<string, JsonValue> => {
|
||||
if (!(cause instanceof GhidraLaunchError)) return {};
|
||||
const launchSupport =
|
||||
cause.launchSupport.length === 0
|
||||
? {}
|
||||
: {
|
||||
launch_support: cause.launchSupport.map((output) => ({
|
||||
...output,
|
||||
stderr: redact(output.stderr),
|
||||
})),
|
||||
};
|
||||
const output = cause.capturedOutput;
|
||||
if (output === undefined) return {};
|
||||
if (output === undefined) return launchSupport;
|
||||
const stdout = boundedUtf8Text(
|
||||
redact(output.stdout),
|
||||
MAX_LAUNCH_COMMAND_OUTPUT_BYTES,
|
||||
GHIDRA_LAUNCH_COMMAND_OUTPUT_BYTES,
|
||||
);
|
||||
const stderr = boundedUtf8Text(
|
||||
redact(output.stderr),
|
||||
MAX_LAUNCH_COMMAND_OUTPUT_BYTES,
|
||||
GHIDRA_LAUNCH_COMMAND_OUTPUT_BYTES,
|
||||
);
|
||||
const truncated = output.truncated || stdout.truncated || stderr.truncated;
|
||||
return {
|
||||
...launchSupport,
|
||||
launch_outcome: {
|
||||
stdout: stdout.text,
|
||||
stderr: stderr.text,
|
||||
|
||||
Reference in New Issue
Block a user