MCPcopy Create free account
hub / github.com/sindresorhus/fkill-cli / processExited

Function processExited

interactive.js:24–45  ·  view source on GitHub ↗
(pid, timeout)

Source from the content-addressed store, hash-verified

22});
23
24const processExited = async (pid, timeout) => {
25 const endTime = Date.now() + timeout;
26 let interval = PROCESS_EXITED_MIN_INTERVAL;
27 if (interval > timeout) {
28 interval = timeout;
29 }
30
31 let exists;
32
33 do {
34 await delay(interval); // eslint-disable-line no-await-in-loop
35
36 exists = await processExists(pid); // eslint-disable-line no-await-in-loop
37
38 interval *= 2;
39 if (interval > PROCESS_EXITED_MAX_INTERVAL) {
40 interval = PROCESS_EXITED_MAX_INTERVAL;
41 }
42 } while (Date.now() < endTime && exists);
43
44 return !exists;
45};
46
47const preferNotMatching = matches => (a, b) => {
48 const aMatches = matches(a);

Callers 1

attemptKillProcessesFunction · 0.85

Calls 1

delayFunction · 0.85

Tested by

no test coverage detected