diff --git a/src/executor/exec_heredoc.c b/src/executor/exec_heredoc.c index d054fc7..4622c79 100644 --- a/src/executor/exec_heredoc.c +++ b/src/executor/exec_heredoc.c @@ -88,23 +88,19 @@ static int is_heredoc(t_redir *node, int i, int pid, t_shell *shell) if (node->type == REDIR_HEREDOC) { + g_signal = 0; line = NULL; route_path_tmp = heredoc_path_temp(i, pid); fd = open(route_path_tmp, O_CREAT | O_WRONLY | O_TRUNC, 0644); if (fd < 0) - { perror("Error de Lectura de archivo 1"); - } if (!heredoc_readline(fd, line, node, shell)) { close(fd); unlink(route_path_tmp); return (free(route_path_tmp), 0); } - close(fd); - free(node->file); - node->file = route_path_tmp; - return (1); + return (close(fd), free(node->file), node->file = route_path_tmp, 1); } return (1); } diff --git a/src/main.c b/src/main.c index e1e97f0..8d30796 100644 --- a/src/main.c +++ b/src/main.c @@ -54,10 +54,10 @@ void show_prompt(t_shell *shell) while (!shell->is_exitting) { set_signal_mode(INTERACTIVE); - g_signal = 0; line = readline("Minishell: "); if (g_signal == SIGINT) shell->exit_status = SIGINT + 128; + g_signal = 0; if (!line) { write(1, "exit\n", 5);