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

Function sh_pipe_run

src/pipeline/pass_shell.c:2555–2583  ·  view source on GitHub ↗

The elements of a pipeline, in order, with what flows through it. An * element that redirects a pipeline continues this one: tree-sitter-bash * folds `a | b` followed by a line `cat <<EOF | c` into `a | (b cat | c)`. */

Source from the content-addressed store, hash-verified

2553 * element that redirects a pipeline continues this one: tree-sitter-bash
2554 * folds `a | b` followed by a line `cat <<EOF | c` into `a | (b cat | c)`. */
2555static void sh_pipe_run(sh_t *s, TSNode n, sh_src_t *src) {
2556 for (uint32_t i = 0; i < ts_node_named_child_count(n); i++) {
2557 TSNode el = ts_node_named_child(n, i);
2558 TSNode cmd = sh_unwrap(el);
2559 if (sh_type(cmd, "pipeline")) {
2560 sh_pipe_run(s, cmd, src);
2561 sh_redirects(s, el);
2562 continue;
2563 }
2564 if (!sh_type(cmd, "command")) {
2565 sh_walk(s, el);
2566 *src = (sh_src_t){SH_SRC_NONE, NULL, NULL};
2567 continue;
2568 }
2569 sh_walk_substs(s, cmd);
2570 sh_argv_t a = {0};
2571 sh_argv_build(s, cmd, &a);
2572 sh_src_t out;
2573 sh_deploy_command(s, cmd, &a, src, &out);
2574 if (out.kind != SH_SRC_NONE) {
2575 *src = out;
2576 }
2577 sh_spawn(s, cmd, &a);
2578 sh_build(s, cmd, &a);
2579 sh_http(s, cmd, &a);
2580 sh_argv_free(&a);
2581 sh_redirects(s, el);
2582 }
2583}
2584
2585/* A pipeline: every element runs in a subshell; a kustomize build or helm
2586 * template feeds the kubectl that reads the pipe. */

Callers 1

sh_pipelineFunction · 0.85

Calls 11

sh_unwrapFunction · 0.85
sh_typeFunction · 0.85
sh_redirectsFunction · 0.85
sh_walkFunction · 0.85
sh_walk_substsFunction · 0.85
sh_argv_buildFunction · 0.85
sh_deploy_commandFunction · 0.85
sh_spawnFunction · 0.85
sh_buildFunction · 0.85
sh_httpFunction · 0.85
sh_argv_freeFunction · 0.85

Tested by

no test coverage detected