MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / waitForChildExit

Function waitForChildExit

packages/codex-native-api/src/codex_app_client.ts:4305–4325  ·  view source on GitHub ↗
(child: ChildProcess | null, timeoutMs: number)

Source from the content-addressed store, hash-verified

4303}
4304
4305function waitForChildExit(child: ChildProcess | null, timeoutMs: number): Promise<void> {
4306 return new Promise<void>((resolve, reject) => {
4307 if (!child || child.exitCode !== null) {
4308 resolve();
4309 return;
4310 }
4311 const timer = setTimeout(() => {
4312 cleanup();
4313 reject(new Error('Timed out waiting for Codex child process to exit'));
4314 }, timeoutMs);
4315 const onExit = () => {
4316 cleanup();
4317 resolve();
4318 };
4319 const cleanup = () => {
4320 clearTimeout(timer);
4321 child.off('exit', onExit);
4322 };
4323 child.on('exit', onExit);
4324 });
4325}
4326
4327async function terminateChildProcess(child: ChildProcess, platform: NodeJS.Platform): Promise<void> {
4328 if (platform === 'win32' && typeof child.pid === 'number') {

Callers 1

terminateChildProcessFunction · 0.70

Calls 3

resolveFunction · 0.85
rejectFunction · 0.85
cleanupFunction · 0.70

Tested by

no test coverage detected