Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(process): align provider detach with configured platform

morluto3fff74fb5bb9
diff --git a/src/ghidra/GhidraLauncher.ts b/src/ghidra/GhidraLauncher.ts
index c0f6e349a..304fa2d6b 100644
--- a/src/ghidra/GhidraLauncher.ts
+++ b/src/ghidra/GhidraLauncher.ts
@@ -131,6 +131,7 @@ export class GhidraHeadlessLauncher implements GhidraLauncher {
// the per-process run token remain the cleanup authority.
expectedCommand: null,
windowsVerbatimArguments: platform === "win32",
+ platform,
env: ghidraLaunchEnvironment(paths, this.options.javaHome, platform),
});
await writeFileAtomic(
diff --git a/tests/boundary/process/providerProcess.test.ts b/tests/boundary/process/providerProcess.test.ts
index fcd81dbba..2eca8d8a7 100644
--- a/tests/boundary/process/providerProcess.test.ts
+++ b/tests/boundary/process/providerProcess.test.ts
@@ -515,3 +515,53 @@ describe("provider process spawning primitives", () => {
).rejects.toMatchObject({ code: "ENOENT" });
});
});
+
+describe("provider process configured-platform spawning", () => {
+ it.skipIf(process.platform === "win32")(
+ "uses the configured platform when establishing process-group identity",
+ async () => {
+ const windowsConfigured = await spawnOwnedProviderProcess({
+ command: process.execPath,
+ arguments: [processFixturePath, "graceful"],
+ runId: "provider-process-configured-win32-run",
+ platform: "win32",
+ });
+ const posixConfigured = await spawnOwnedProviderProcess({
+ command: process.execPath,
+ arguments: [processFixturePath, "graceful"],
+ runId: "provider-process-configured-posix-run",
+ platform: "linux",
+ });
+ try {
+ await Promise.all([
+ waitForProviderProcessReady(windowsConfigured.process),
+ waitForProviderProcessReady(posixConfigured.process),
+ ]);
+ await expect(
+ observeOwnedProcessLineage(windowsConfigured.ownership),
+ ).resolves.toMatchObject({
+ status: "unavailable",
+ reason: "owned launcher process-group identity did not match",
+ launcherPid: windowsConfigured.process.pid,
+ });
+ await expect(
+ observeOwnedProcessLineage(posixConfigured.ownership),
+ ).resolves.toMatchObject({
+ status: "verified",
+ lineage: {
+ runId: "provider-process-configured-posix-run",
+ launcherPid: posixConfigured.process.pid,
+ launcherParentPid: process.pid,
+ processGroupId: posixConfigured.process.pid,
+ descendants: [],
+ },
+ });
+ } finally {
+ await Promise.all([
+ stopProviderProcessFixture(windowsConfigured.process),
+ stopProviderProcessFixture(posixConfigured.process),
+ ]);
+ }
+ },
+ );
+});