Merge pull request #1201 from morluto/fix/ghidra-runtime-cleanup-retry

fix(ghidra): keep and name a runtime directory that close could not remove
This commit is contained in:
Kaoru0822
2026-10-08 22:49:12 -07:00
committed by GitHub
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;
}
}