🔨」 fix(prints): fixed prints to error output

This commit is contained in:
y-syo
2024-08-14 10:24:52 +02:00
parent 07cd9771bf
commit a77d92de5d
2 changed files with 7 additions and 7 deletions

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/01 14:55:06 by mmoussou #+# #+# */
/* Updated: 2024/08/14 10:18:44 by mmoussou ### ########.fr */
/* Updated: 2024/08/14 10:20:57 by mmoussou ### ########.fr */
/* */
/* ************************************************************************** */
@ -32,7 +32,7 @@ int exec_fork_cmd(t_cmd *cmd, char **env, t_env *env_t, int pipe_fd[2])
if (exec.status == -1 || !input || check_file(cmd->cmd, input))
{
if (exec.status == -1)
ft_printf("%s%s\n", ERROR_NO_CMD, input, get_exit_code(127));
ft_printf_fd(2, "%s%s\n", ERROR_NO_CMD, input, get_exit_code(127));
free(input);
return (-1);
}
@ -67,7 +67,7 @@ int exec_single_cmd(t_cmd *cmd, char **env, t_env *env_t, int pipe_fd[2])
if (exec.status == -1)
get_exit_code(127);
if (exec.status == -1)
printf("minishell : command not found: %s\n", input);
ft_printf_fd(2, "minishell : command not found: %s\n", input);
free(input);
return (-1);
}

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/09 19:25:18 by adjoly #+# #+# */
/* Updated: 2024/08/14 08:07:55 by mmoussou ### ########.fr */
/* Updated: 2024/08/14 10:23:48 by mmoussou ### ########.fr */
/* */
/* ************************************************************************** */
@ -103,7 +103,7 @@ int check_file(char *cmd, char *input)
if (status || !cmd || !*cmd)
{
get_exit_code(127);
printf("minishell : command not found: %s\n", input);
ft_printf_fd(2, "minishell : command not found: %s\n", input);
return (1);
}
if (!S_ISDIR(entry.st_mode) && !access(cmd, X_OK))
@ -111,12 +111,12 @@ int check_file(char *cmd, char *input)
if (S_ISDIR(entry.st_mode))
{
get_exit_code(126);
printf("minishell : %s is a directory.\n", input);
ft_printf_fd(2, "minishell : %s is a directory.\n", input);
}
else
{
get_exit_code(127);
printf("minishell : command not found: %s\n", input);
ft_printf_fd(2, "minishell : command not found: %s\n", input);
}
return (1);
}