fix un truc
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/02/21 21:47:15 by marde-vr #+# #+# */
|
/* Created: 2024/02/21 21:47:15 by marde-vr #+# #+# */
|
||||||
/* Updated: 2024/05/03 12:51:56 by marde-vr ### ########.fr */
|
/* Updated: 2024/05/06 13:37:25 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -99,9 +99,8 @@ void get_cmd_path(t_msh *msh)
|
|||||||
ft_printf_fd(2, "'': command not found\n");
|
ft_printf_fd(2, "'': command not found\n");
|
||||||
else
|
else
|
||||||
ft_printf_fd(2, "%s: command not found\n", msh->tokens->value);
|
ft_printf_fd(2, "%s: command not found\n", msh->tokens->value);
|
||||||
free(msh->tokens->value);
|
//free(msh->tokens->value);
|
||||||
msh->tokens->value = 0;
|
//msh->tokens->value = 0;
|
||||||
g_return_code = 127;
|
g_return_code = 127;
|
||||||
msh->in_fd = -2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
srcs/pipe.c
11
srcs/pipe.c
@ -6,7 +6,7 @@
|
|||||||
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/03/05 18:17:25 by marde-vr #+# #+# */
|
/* Created: 2024/03/05 18:17:25 by marde-vr #+# #+# */
|
||||||
/* Updated: 2024/05/03 13:13:36 by marde-vr ### ########.fr */
|
/* Updated: 2024/05/06 13:41:24 by tomoron ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -18,9 +18,9 @@ void close_pipe_fds(t_msh *msh, int i)
|
|||||||
{
|
{
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
{
|
{
|
||||||
if (msh->fds[i - 1][0] > 2)
|
if (msh->fds[i - 1] && msh->fds[i - 1][0] > 2)
|
||||||
close(msh->fds[i - 1][0]);
|
close(msh->fds[i - 1][0]);
|
||||||
if (msh->fds[i - 1][1] > 2)
|
if (msh->fds[i - 1] && msh->fds[i - 1][1] > 2)
|
||||||
close(msh->fds[i - 1][1]);
|
close(msh->fds[i - 1][1]);
|
||||||
}
|
}
|
||||||
if (msh->fds[i] && msh->fds[i][0] > 2)
|
if (msh->fds[i] && msh->fds[i][0] > 2)
|
||||||
@ -74,10 +74,7 @@ void execute_command(t_msh *msh, char **cmd_args)
|
|||||||
{
|
{
|
||||||
env = env_to_char_tab(msh->env);
|
env = env_to_char_tab(msh->env);
|
||||||
if (env)
|
if (env)
|
||||||
{
|
execve(msh->tokens->value, cmd_args, env);
|
||||||
if (execve(msh->tokens->value, cmd_args, env))
|
|
||||||
perror("execve");
|
|
||||||
}
|
|
||||||
ft_free_str_arr(env);
|
ft_free_str_arr(env);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user