Fixed waiting on previous command for pipeline to spawn next

This commit is contained in:
Maix0 2024-08-13 16:01:45 +02:00
parent 45bacdd3c0
commit aac10822d3
13 changed files with 679 additions and 52 deletions

View file

@ -6,12 +6,12 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/07 13:58:37 by rparodi #+# #+# */
/* Updated: 2024/08/12 18:14:08 by rparodi ### ########.fr */
/* Updated: 2024/08/13 15:14:47 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "exec/builtins.h"
#include "me/mem/mem.h"
#include "me/printf/printf.h"
#include "me/string/string.h"
#include "me/types.h"
#include <errno.h>
@ -26,9 +26,9 @@ t_error builtin_pwd___(t_state *state, t_builtin_spawn_info info, t_i32 *exit_co
if (errno == ERANGE)
string_reserve(&s, s.capacity * 3);
else
return (string_free(s), ERROR);
return (*exit_code = 1, string_free(s), me_printf_fd(info.stderr, "cd: Unable to get current directory\n"), NO_ERROR);
}
printf("%s\n", s.buf);
me_printf_fd(info.stdout, "%s\n", s.buf);
string_free(s);
return (*exit_code = 0, NO_ERROR);
}