Skip to content

armgit / rea

Public Imported from GitHub
0

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

test(windows): hold sharing conflict through first close attempt

morluto94d9bffaf663
diff --git a/scripts/verify-windows-native.mjs b/scripts/verify-windows-native.mjs
index f27cadd7a..70821c0a9 100644
--- a/scripts/verify-windows-native.mjs
+++ b/scripts/verify-windows-native.mjs
@@ -616,10 +616,21 @@ process.stdout.write(JSON.stringify({executable:basename(process.execPath),abiVe
try {
await transientRuntime.snapshot(source, "snapshot.bin");
transientHolder = await startDeleteSharingDeniedReader(transientHeldPath);
- // The first native close is synchronous and must fail while this reader
- // is held. Releasing it while the owner waits allows its own retry to
- // complete without the caller issuing another close.
+ // Keep the reader held through the first close attempt. Without retries,
+ // close rejects before the next event-loop turn; with retries, it remains
+ // pending until the caller releases this sharing conflict.
+ let closeSettled = false;
const closing = transientRuntime.close();
+ void closing.then(
+ () => {
+ closeSettled = true;
+ },
+ () => {
+ closeSettled = true;
+ },
+ );
+ await new Promise((resolve) => setImmediate(resolve));
+ assert.equal(closeSettled, false);
transientHolder.child.stdin.end("\n");
const [, [exitCode]] = await Promise.all([
closing,