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

Function cbm_cli_stdin_kind

src/cli/cli.c:14099–14113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14097static bool cli_stdin_allowed_for_schema(const char *schema_str, cbm_cli_stdin_kind_t stdin_kind);
14098
14099cbm_cli_stdin_kind_t cbm_cli_stdin_kind(int fd) {
14100#ifdef _WIN32
14101 bool terminal = _isatty(fd) != 0;
14102#else
14103 bool terminal = isatty(fd) != 0;
14104#endif
14105 if (terminal) {
14106 return CBM_CLI_STDIN_TERMINAL;
14107 }
14108 struct stat state;
14109 if (fstat(fd, &state) == 0 && S_ISREG(state.st_mode)) {
14110 return CBM_CLI_STDIN_FILE;
14111 }
14112 return CBM_CLI_STDIN_STREAM;
14113}
14114
14115bool cbm_cli_args_from_stdin_allowed(const char *tool_name, cbm_cli_stdin_kind_t stdin_kind) {
14116 /* An interactive run has nothing piped to read: consulting the terminal

Callers 2

run_cliFunction · 0.85
test_cli.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected