summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorÁkos Kőrösi <korakos99@gmail.com>2026-05-24 14:21:23 +0200
committerÁkos Kőrösi <korakos99@gmail.com>2026-05-24 14:21:23 +0200
commit36c518cca8660f2bde6116c9305ddd84f8832c44 (patch)
tree5171e847d0537707ed8a9cb60a088e850cc12eee /src
parentd7d48bb2195df25f5caf3fe2232eab83e0edddc2 (diff)
cmdsub maybe works now
Diffstat (limited to 'src')
-rw-r--r--src/preproc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/preproc.c b/src/preproc.c
index 8d5525e..7e93b4c 100644
--- a/src/preproc.c
+++ b/src/preproc.c
@@ -44,10 +44,18 @@ char* get_cmdsub_output(TokenVec sub_region, ShellState* shstate) {
pipe(pipe_fds);
PipelineTree sub_tree = process_ast(sub_region, shstate);
+ printf("AST done\n");
// TODO: tree cleanup
+
+ // TODO: is this ok? where should we manage the pgid?
+ int pgid = -1;
+ Channel write_cha = {.fd = pipe_fds[1], .parent_proc_closable = false, .child_proc_closable = true};
+ execute_command_pipeline(*sub_tree.root, STDIN_CHA, write_cha, true, &pgid, shstate);
+ close(pipe_fds[1]);
//execute_pipeline_tree(*sub_tree.root, shstate, STDIN_FILENO, pipe_fds[1]);
+ printf("Execution done\n");
String output_buf = make_String(256);
char str_buf[256];
@@ -56,7 +64,6 @@ char* get_cmdsub_output(TokenVec sub_region, ShellState* shstate) {
append_str_to_String(&output_buf, str_buf);
}
close(pipe_fds[0]);
- close(pipe_fds[1]);
return inner(&output_buf);
}