MCPcopy Create free account
hub / github.com/Noumena-Network/code / waitForProcessExit

Function waitForProcessExit

src/testing/tmuxHarness.ts:385–411  ·  view source on GitHub ↗
(
  process: ChildProcessWithoutNullStreams,
  timeoutMs: number,
)

Source from the content-addressed store, hash-verified

383}
384
385async function waitForProcessExit(
386 process: ChildProcessWithoutNullStreams,
387 timeoutMs: number,
388): Promise<boolean> {
389 if (process.exitCode !== null) {
390 return true
391 }
392
393 return await new Promise<boolean>(resolve => {
394 const timeout = setTimeout(() => {
395 cleanup()
396 resolve(false)
397 }, timeoutMs)
398
399 const onExit = () => {
400 cleanup()
401 resolve(true)
402 }
403
404 const cleanup = () => {
405 clearTimeout(timeout)
406 process.off('exit', onExit)
407 }
408
409 process.on('exit', onExit)
410 })
411}
412
413export async function detachTmuxClient(
414 session: IsolatedTmuxSession,

Callers 1

detachTmuxClientFunction · 0.85

Calls 2

cleanupFunction · 0.70
resolveFunction · 0.50

Tested by

no test coverage detected