stop quand here_doc fail

This commit is contained in:
2024-04-26 10:36:57 +02:00
parent 6de6904a67
commit 390937d195
6 changed files with 9 additions and 7 deletions

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */ /* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/24 10:58:36 by marde-vr #+# #+# */ /* Created: 2024/04/24 10:58:36 by marde-vr #+# #+# */
/* Updated: 2024/04/25 18:55:17 by marde-vr ### ########.fr */ /* Updated: 2024/04/26 10:26:03 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -75,7 +75,7 @@ void print_env_declare(t_msh *msh, t_env *env_orig)
} }
env = env->next; env = env->next;
} }
free_env_cpy(env); free_env_cpy(start);
} }
void delete_from_env(t_msh *msh, char *name) void delete_from_env(t_msh *msh, char *name)

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */ /* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/28 13:50:14 by tomoron #+# #+# */ /* Created: 2024/03/28 13:50:14 by tomoron #+# #+# */
/* Updated: 2024/04/25 19:20:22 by tomoron ### ########.fr */ /* Updated: 2024/04/26 10:34:15 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -72,7 +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) void exec_command(t_msh *msh, int i, int cmd_count)
{ {
if(msh->out_fd != -1 || msh->in_fd != -1) g_return_code = 0;
if(msh->out_fd != -1 && msh->in_fd != -1)
{ {
msh->fds[i] = ft_calloc(2, sizeof(int *)); msh->fds[i] = ft_calloc(2, sizeof(int *));
if (!msh->fds[i]) if (!msh->fds[i])
@ -82,7 +83,6 @@ void exec_command(t_msh *msh, int i, int cmd_count)
if ((msh->tokens && msh->tokens->value) || is_parenthesis(msh->cmds)) if ((msh->tokens && msh->tokens->value) || is_parenthesis(msh->cmds))
exec(msh, get_cmd_args(msh), i, cmd_count); exec(msh, get_cmd_args(msh), i, cmd_count);
} }
g_return_code = 0;
remove_command_from_msh(msh); remove_command_from_msh(msh);
} }

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */ /* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/18 18:29:20 by marde-vr #+# #+# */ /* Created: 2024/02/18 18:29:20 by marde-vr #+# #+# */
/* Updated: 2024/04/25 18:59:15 by marde-vr ### ########.fr */ /* Updated: 2024/04/26 10:29:05 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -88,6 +88,7 @@ int ft_export(t_msh *msh, t_token *cmd, t_env *env)
{ {
int error; int error;
error = 0;
if (cmd && !cmd->next) if (cmd && !cmd->next)
{ {
print_env_declare(msh, env); print_env_declare(msh, env);

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */ /* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/02 21:59:20 by tomoron #+# #+# */ /* Created: 2024/02/02 21:59:20 by tomoron #+# #+# */
/* Updated: 2024/04/25 18:38:02 by tomoron ### ########.fr */ /* Updated: 2024/04/26 10:24:46 by tomoron ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -98,6 +98,7 @@ int init_minishell(t_msh **msh, int argc, char **argv, char **envp)
(*msh)->env = get_env(envp); (*msh)->env = get_env(envp);
(*msh)->env = add_shlvl((*msh)->env); (*msh)->env = add_shlvl((*msh)->env);
rl_catch_signals = 0; rl_catch_signals = 0;
g_return_code = 0;
signal(SIGINT, signal_handler_interactive); signal(SIGINT, signal_handler_interactive);
signal(SIGQUIT, signal_handler_interactive); signal(SIGQUIT, signal_handler_interactive);
return (0); return (0);