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

Function cbm_popen

src/foundation/compat_fs.c:370–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370FILE *cbm_popen(const char *cmd, const char *mode) {
371 /* Our git shell-outs are all read-mode; they MUST use the isolated
372 * spawn. On failure, log and fail the call — never fall back to
373 * _popen, whose full handle inheritance re-arms the UI hang (#798). */
374 if (mode && mode[0] == 'r' && mode[1] == '\0') {
375 const char *stage = "";
376 DWORD gle = 0;
377 FILE *fp = cbm_popen_isolated(cmd, &stage, &gle);
378 g_popen_last_isolated = (fp != NULL);
379 if (!fp) {
380 char glebuf[CBM_SZ_16];
381 char errnobuf[CBM_SZ_16];
382 snprintf(glebuf, sizeof(glebuf), "%lu", (unsigned long)gle);
383 snprintf(errnobuf, sizeof(errnobuf), "%d", errno);
384 cbm_log_warn("compat.popen_isolated_failed", "stage", stage, "gle", glebuf, "errno",
385 errnobuf);
386 }
387 return fp;
388 }
389 g_popen_last_isolated = 0;
390 return _popen(cmd, mode);
391}
392
393int cbm_pclose(FILE *f) {
394 InitOnceExecuteOnce(&g_popen_once, cbm_popen_init, NULL, NULL);

Callers 7

git_captureFunction · 0.85
fetch_latest_tagFunction · 0.85
handle_search_codeFunction · 0.85
parse_git_logFunction · 0.85
git_head_hashFunction · 0.85
ensure_gitattributesFunction · 0.85
test_security.cFile · 0.85

Calls 1

cbm_popen_isolatedFunction · 0.85

Tested by

no test coverage detected