MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / waitForChildClose

Function waitForChildClose

apps/local/src/db/data-dir-ownership.test.ts:89–114  ·  view source on GitHub ↗
(
  output: ChildOutput,
  timeoutMs: number,
)

Source from the content-addressed store, hash-verified

87};
88
89const waitForChildClose = async (
90 output: ChildOutput,
91 timeoutMs: number,
92): Promise<ChildCloseResult> =>
93 new Promise((resolve) => {
94 const complete = (timedOut: boolean) => {
95 clearTimeout(timer);
96 output.child.off("close", onClose);
97 resolve({
98 timedOut,
99 exitCode: output.child.exitCode,
100 signalCode: output.child.signalCode,
101 stdout: output.stdout.trim(),
102 stderr: output.stderr.trim(),
103 });
104 };
105 const onClose = () => complete(false);
106 const timer = setTimeout(() => complete(true), timeoutMs);
107
108 if (output.child.exitCode !== null || output.child.signalCode !== null) {
109 complete(false);
110 return;
111 }
112
113 output.child.once("close", onClose);
114 });
115
116const waitForMarker = async (
117 markerPath: string,

Callers 2

killChildFunction · 0.70
runAcquireAttemptFunction · 0.70

Calls 1

completeFunction · 0.70

Tested by

no test coverage detected