No redirection on built-in
Closed this issue · 2 comments
mbraga-s commented
If a built-in is called by the parent pro ess (therefore outside of a fork), redirections aren't applied properly:
echo hi >outfile
cd - >outfile
Even tho infiles aren't considered for the built-ins, they still need to be opened.
mbraga-s commented
Possible fix (needs to be thought out): only changing the file descriptor of the write segments of the built-ins. By default it's one but if an outfile is given the fd changes to that files fd.
void exec_echo (t_data *data, int fd)
{ ...
write (fd, stuff, sizeof(stuff));
...
}
mbraga-s commented
Fixed but will probably need to re-implement when Manuel merges his latest batch of built-in fixes with the rest of minishell