🔨」 fix: fixed some things.

This commit is contained in:
yosyo
2024-08-01 06:21:46 +02:00
parent c7cdcf4f9a
commit 180b1d2b71
2 changed files with 7 additions and 5 deletions

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */ /* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/15 12:28:36 by adjoly #+# #+# */ /* Created: 2024/07/15 12:28:36 by adjoly #+# #+# */
/* Updated: 2024/07/16 12:33:43 by mmoussou ### ########.fr */ /* Updated: 2024/08/01 06:17:16 by mmoussou ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -26,5 +26,6 @@ void free_exit(t_env *env, char **env_array)
rl_clear_history(); rl_clear_history();
ft_envclear(&env, free); ft_envclear(&env, free);
ft_lstclear(get_list(NULL), &free_cmd); ft_lstclear(get_list(NULL), &free_cmd);
ft_free("a", &env_array); if (env_array)
ft_free("a", &env_array);
} }

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */ /* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/01 14:55:06 by mmoussou #+# #+# */ /* Created: 2024/06/01 14:55:06 by mmoussou #+# #+# */
/* Updated: 2024/07/29 11:59:39 by mmoussou ### ########.fr */ /* Updated: 2024/08/01 06:10:04 by mmoussou ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -24,6 +24,8 @@ int exec_fork_cmd(t_cmd *cmd, char **env, t_env *env_t, int pipe_fd[2])
int fork_pid; int fork_pid;
char *input; char *input;
if (!cmd->cmd)
return (get_exit_code(0));
input = ft_strdup(cmd->cmd); input = ft_strdup(cmd->cmd);
exec.pipe_fd[0] = pipe_fd[0]; exec.pipe_fd[0] = pipe_fd[0];
exec.pipe_fd[1] = pipe_fd[1]; exec.pipe_fd[1] = pipe_fd[1];
@ -32,9 +34,8 @@ int exec_fork_cmd(t_cmd *cmd, char **env, t_env *env_t, int pipe_fd[2])
{ {
if (exec.status == -1) if (exec.status == -1)
printf("minishell : command not found: %s\n", input); printf("minishell : command not found: %s\n", input);
get_exit_code(127);
free(input); free(input);
return (-1); return (get_exit_code(127));
} }
free(input); free(input);
fork_pid = fork(); fork_pid = fork();