From 94d9bffaf66370e409019a327ff5a3018a4202e6 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Fri, 16 Oct 2026 03:38:28 +0800 Subject: [PATCH] test(windows): hold sharing conflict through first close attempt Keep the delete-sharing-denied reader held until the next event-loop turn and assert close is still pending before releasing it. This distinguishes an internal retry from a holder that releases before cleanup starts. --- scripts/verify-windows-native.mjs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/verify-windows-native.mjs b/scripts/verify-windows-native.mjs index f27cadd7a6..70821c0a97 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,