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

Function spawn_ignoring_tree

tests/test_subprocess.c:703–718  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

701}
702
703static int spawn_ignoring_tree(const char *pid_path, int quiet_timeout_ms, int cancel_grace_ms,
704 cbm_subprocess_t **out) {
705 /* The direct child installs its trap before starting a nested shell. The two
706 * PIDs are written only after the nested process exists, eliminating the
707 * cancellation-before-trap race from the test. */
708 const char *script = "trap '' TERM; "
709 "/bin/sh -c 'trap \"\" TERM; while :; do sleep 1; done' cbm-grandchild & "
710 "grandchild=$!; echo \"$$ $grandchild\" > \"$1\"; wait";
711 const char *argv[] = {"/bin/sh", "-c", script, "cbm-parent", pid_path, NULL};
712 cbm_proc_opts_t opts = {0};
713 opts.bin = "/bin/sh";
714 opts.argv = argv;
715 opts.quiet_timeout_ms = quiet_timeout_ms;
716 opts.cancel_grace_ms = cancel_grace_ms;
717 return cbm_subprocess_spawn(&opts, out);
718}
719
720typedef struct {
721 cbm_subprocess_t *process;

Callers 1

test_subprocess.cFile · 0.85

Calls 1

cbm_subprocess_spawnFunction · 0.85

Tested by

no test coverage detected