Commit graph

3 commits

Author SHA1 Message Date
93f3ea7c66 fix(exec): prevent leak when calling exit() in a subprocess
This was because at the point at which exit is called, we can only free a
t_simple_cmd, but not the whole t_cmd tree. This commit introduces a convention
of returning a t_subprocess enum from each function in exec. If the current
thread is a subprocess, SUBPROCESS is returned, else PARENTPROCESS. We also no
longer call exit in subproceses. This way, all processes bubble up to main,
where if SUBPROCESS is returned, all memory is freed and the program exits.

This also removes the previous should_exit convention.

Still TODO: handling of the exit builtin, which should also bubble up in the
same way.
2025-04-29 15:20:05 +02:00
733ae1093a fix(exec): correctly exit subprocesses, do not keep multiple shells in parallel 2025-04-16 17:30:25 +02:00
8feacccb15
group_cmd_execute: fork and passthrough to cmd_execute 2025-04-15 15:11:26 +02:00