extension-install 4.4.1 → 4.4.2-canary.487.93cd555
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module.cjs +9 -3
- package/package.json +1 -1
package/dist/module.cjs
CHANGED
|
@@ -443,15 +443,21 @@ function removeStaleLock(lockDir, seams) {
|
|
|
443
443
|
});
|
|
444
444
|
return true;
|
|
445
445
|
}
|
|
446
|
-
const
|
|
446
|
+
const MID_REMOVAL_WAIT_MS = 500;
|
|
447
|
+
const MID_REMOVAL_STEP_MS = 5;
|
|
448
|
+
function pause(ms) {
|
|
449
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
450
|
+
}
|
|
447
451
|
function makeLockDir(lockDir) {
|
|
448
|
-
|
|
452
|
+
const giveUpAt = Date.now() + MID_REMOVAL_WAIT_MS;
|
|
453
|
+
for(;;)try {
|
|
449
454
|
external_node_fs_default().mkdirSync(lockDir);
|
|
450
455
|
return;
|
|
451
456
|
} catch (error) {
|
|
452
457
|
const code = error.code;
|
|
453
458
|
const midRemoval = 'EPERM' === code && !external_node_fs_default().existsSync(lockDir);
|
|
454
|
-
if (!midRemoval ||
|
|
459
|
+
if (!midRemoval || Date.now() >= giveUpAt) throw error;
|
|
460
|
+
pause(MID_REMOVAL_STEP_MS);
|
|
455
461
|
}
|
|
456
462
|
}
|
|
457
463
|
function take(lockDir, timeoutMs, seams) {
|
package/package.json
CHANGED