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

Function cbm_exec_no_shell

src/foundation/compat_fs.c:741–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

739}
740
741int cbm_exec_no_shell(const char *const *argv) {
742 if (!argv || !argv[0]) {
743 return CBM_NOT_FOUND;
744 }
745
746 wchar_t *cmdline = cbm_build_cmdline(argv);
747 if (!cmdline) {
748 return CBM_NOT_FOUND;
749 }
750
751 STARTUPINFOW si;
752 PROCESS_INFORMATION pi;
753 memset(&si, 0, sizeof(si));
754 memset(&pi, 0, sizeof(pi));
755 si.cb = sizeof(si);
756
757 /* CREATE_NO_WINDOW: the third and last spawn site that still needed it
758 * (#1427). Without it every helper routed through here — git, codesign,
759 * open — flashes a console window, and under a stdio MCP session with
760 * auto_watch those steal focus while the user is typing. The other three
761 * CreateProcessW sites already set it: subprocess.c and cbm_popen_isolated
762 * via #1448, and the detached daemon spawn in daemon/bootstrap.c, which has
763 * had it since it was written. */
764 if (!CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) {
765 free(cmdline);
766 return CBM_NOT_FOUND;
767 }
768 free(cmdline);
769
770 WaitForSingleObject(pi.hProcess, INFINITE);
771 DWORD exit_code = (DWORD)CBM_NOT_FOUND;
772 GetExitCodeProcess(pi.hProcess, &exit_code);
773 CloseHandle(pi.hProcess);
774 CloseHandle(pi.hThread);
775 return (int)exit_code;
776}
777
778#else /* POSIX */
779

Callers 11

cbm_download_to_fileFunction · 0.85
cbm_macos_adhoc_signFunction · 0.85
cbm_cmd_installFunction · 0.85
cbm_cmd_updateFunction · 0.85
test_cli.cFile · 0.85
test_mcp.cFile · 0.85
test_path_alias.cFile · 0.85
test_security.cFile · 0.85

Calls 3

cbm_build_cmdlineFunction · 0.85
execvpFunction · 0.85
_exitFunction · 0.85

Tested by

no test coverage detected