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

Function cli_fd_capture_begin

tests/test_cli.c:754–769  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

752} cli_fd_capture_t;
753
754static void cli_fd_capture_begin(cli_fd_capture_t *capture, FILE *stream, int target_fd) {
755 memset(capture, 0, sizeof(*capture));
756 capture->stream = stream;
757 capture->target_fd = target_fd;
758 capture->saved_fd = -1;
759 capture->file = tmpfile();
760 if (!capture->file) {
761 return;
762 }
763 capture->saved_fd = dup(target_fd);
764 if (capture->saved_fd < 0) {
765 return;
766 }
767 fflush(stream);
768 capture->redirected = dup2(fileno(capture->file), target_fd) >= 0;
769}
770
771/* Returns the captured text (heap, "" when nothing was written) or NULL when
772 * the capture never engaged. */

Callers 1

test_cli.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected