| 406 | } |
| 407 | |
| 408 | FILE *cbm_popen_git(const char *cmd) { |
| 409 | /* Fail closed: without the scrubbed block the child would inherit a |
| 410 | * caller's GIT_DIR and read the wrong repository (#2003). */ |
| 411 | wchar_t *env = cbm_git_child_env_block(); |
| 412 | if (!env) { |
| 413 | cbm_log_warn("compat.popen_git_env_failed", "stage", "env_block"); |
| 414 | return NULL; |
| 415 | } |
| 416 | FILE *fp = cbm_popen_read_isolated(cmd, env); |
| 417 | cbm_git_child_env_free(env); /* CreateProcessW copies the block into the child */ |
| 418 | return fp; |
| 419 | } |
| 420 | |
| 421 | int cbm_pclose(FILE *f) { |
| 422 | InitOnceExecuteOnce(&g_popen_once, cbm_popen_init, NULL, NULL); |
no test coverage detected