This commit is contained in:
2024-04-25 19:20:46 +02:00
parent 1366c49e99
commit 36f7bfd64d
2 changed files with 16 additions and 26 deletions

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/28 13:50:14 by tomoron #+# #+# */
/* Updated: 2024/04/25 18:21:20 by tomoron ### ########.fr */
/* Updated: 2024/04/25 19:20:22 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -72,9 +72,8 @@ int exec(t_msh *msh, char **cmd_args, int i, int cmd_count)
void exec_command(t_msh *msh, int i, int cmd_count)
{
if(msh->in_fd == -1 || msh->out_fd == -1)
return ;
g_return_code = 0;
if(msh->out_fd != -1 || msh->in_fd != -1)
{
msh->fds[i] = ft_calloc(2, sizeof(int *));
if (!msh->fds[i])
ft_exit(msh, 1);
@ -82,6 +81,8 @@ void exec_command(t_msh *msh, int i, int cmd_count)
get_cmd_path(msh);
if ((msh->tokens && msh->tokens->value) || is_parenthesis(msh->cmds))
exec(msh, get_cmd_args(msh), i, cmd_count);
}
g_return_code = 0;
remove_command_from_msh(msh);
}
@ -134,7 +135,7 @@ void exec_commands(t_msh *msh)
if (!msh->pids || !msh->fds)
ft_exit(msh, 1);
i = -1;
while (++i < cmd_count)
while (++i < cmd_count && msh->in_fd >= 0 && msh->out_fd >= 0)
{
get_redirections(msh, msh->cmds);
exec_command(msh, i, cmd_count);

View File

@ -1,25 +1,14 @@
exit with positive and negative 18/19 digits
check error codes
Export multiple variables
./tester os_specific
Open file descriptor with cat << eof | ls open fd and infinte loop
Cat makefile | (echo yes && rev) leaks
echo yes && echo yes && car dhdgdgjsk || echo no leaks
echo yes && echo yes && cat dhdgdgjsk || echo a leaks
echo abc && echo def | cat | rev && echo yes
(), ((())), (())
export leaks
export leaks AAAAAAAAAAAAAAAAAAAAAA
fix broken tests from tester
To test:
ctrl backslash in middle of line
ctrl c on character we are ln with cursor, not end of line
Open file descriptor with cat << eof | ls open fd and infinte loop
test signals
test and verify all malocs