MCPcopy
hub / github.com/OpenCoworkAI/open-codesign / withRmRetry

Function withRmRetry

apps/desktop/scripts/after-pack-prune.cjs:23–36  ·  view source on GitHub ↗
(fn)

Source from the content-addressed store, hash-verified

21}
22
23function withRmRetry(fn) {
24 for (let attempt = 0; attempt <= 3; attempt += 1) {
25 try {
26 fn();
27 return;
28 } catch (err) {
29 if (err?.code === 'ENOENT') return;
30 if (!['EBUSY', 'ENOTEMPTY', 'EPERM'].includes(err?.code) || attempt === 3) {
31 throw err;
32 }
33 sleepSync(50 * (attempt + 1));
34 }
35 }
36}
37
38function rm(target) {
39 const pending = [target];

Callers 1

rmFunction · 0.85

Calls 1

sleepSyncFunction · 0.85

Tested by

no test coverage detected