MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_subprocess_run

Function cbm_subprocess_run

src/foundation/subprocess.c:1473–1496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1471}
1472
1473int cbm_subprocess_run(const cbm_proc_opts_t *opts, cbm_proc_result_t *out) {
1474 cbm_proc_result_t local;
1475 if (!out) {
1476 out = &local;
1477 }
1478 cbm_subprocess_result_init(out);
1479
1480 cbm_subprocess_t *process = NULL;
1481 if (cbm_subprocess_spawn(opts, &process) != 0) {
1482 return -1;
1483 }
1484 for (;;) {
1485 cbm_proc_poll_t state = cbm_subprocess_poll(process, out);
1486 if (state == CBM_PROC_POLL_TERMINAL) {
1487 bool supervised = out->tree_quiesced && !out->supervision_failed;
1488 cbm_subprocess_destroy(process);
1489 return supervised ? 0 : -1;
1490 }
1491 /* A valid owned handle has no ERROR state; invalid-argument errors are
1492 * rejected before this compatibility loop is entered. */
1493 const struct timespec delay = {0, 10000000L}; /* 10 ms */
1494 (void)cbm_nanosleep(&delay, NULL);
1495 }
1496}

Callers 5

mcp_test_gitFunction · 0.85
run_shFunction · 0.85
test_subprocess.cFile · 0.85
ipc_test_win_lock_childFunction · 0.85
app_test_gitFunction · 0.85

Calls 5

cbm_subprocess_spawnFunction · 0.85
cbm_subprocess_pollFunction · 0.85
cbm_subprocess_destroyFunction · 0.85
cbm_nanosleepFunction · 0.85

Tested by 4

mcp_test_gitFunction · 0.68
run_shFunction · 0.68
ipc_test_win_lock_childFunction · 0.68
app_test_gitFunction · 0.68