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)`. */
| 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)`. */ |
| 2555 | static 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. */ |
no test coverage detected