fix(ghidra): keep and name a runtime directory that close could not remove

When removing Ghidra's private runtime directory failed, close_binary
reported only a generic `provider-client` resource, and a later close,
after the permission was restored, returned success while the directory
and its contents remained. The client dropped its reference to the root
before removing it, and PrivateRuntimeRoot cached the rejected removal.

Keep each runtime or socket root until its removal succeeds, report a
failure as a ProviderCleanupError naming the leftover paths, let
PrivateRuntimeRoot retry a failed removal, and pass such typed cleanup
failures through closeAnalysisClient instead of replacing them.

Fixes #1190

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-09 04:19:10 +00:00
co-authored by Claude Opus 5.5
parent f36c10f9e8
commit b79d379c25
5 changed files with 132 additions and 15 deletions
+10 -3
View File
@@ -86,12 +86,19 @@ export class PrivateRuntimeRoot {
}
}
/** Remove the runtime root; concurrent and repeated callers share cleanup. */
/**
* Remove the runtime root; concurrent callers share one attempt. A failed
* attempt is not cached, so a later close retries the removal.
*/
close(): Promise<void> {
this.#closePromise ??=
this.#closePromise ??= (
this.windowsRuntime === undefined
? rm(this.path, { recursive: true, force: true })
: Promise.resolve().then(() => this.windowsRuntime?.close());
: Promise.resolve().then(() => this.windowsRuntime?.close())
).catch((cause: unknown) => {
this.#closePromise = undefined;
throw cause;
});
return this.#closePromise;
}
}