shell _script() use gnl() instead of readline()

to prevent copy of input to terminal.
+ here_doc_write_script()  for nontty STDIN
This commit is contained in:
LuckyLaszlo
2021-12-18 15:25:45 +01:00
parent 0e520ef31e
commit 49099a0abd
5 changed files with 122 additions and 65 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/10 23:53:17 by lperrey #+# #+# */
/* Updated: 2021/12/16 06:35:03 by lperrey ### ########.fr */
/* Updated: 2021/12/18 14:15:13 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -20,7 +20,10 @@ int exit_free(t_all *c, int exit_status)
ft_free_2d_arr(environ);
ft_free_2d_arr(c->path);
free_pipeline(&c->pipeline);
rl_clear_history();
if (!isatty(STDIN_FILENO))
gnl(STDIN_FILENO, NULL, 1);
else
rl_clear_history();
close_stdio();
exit(exit_status);
}

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/23 18:56:53 by lperrey #+# #+# */
/* Updated: 2021/11/26 21:45:22 by lperrey ### ########.fr */
/* Updated: 2021/12/18 14:21:47 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -35,4 +35,5 @@ void set_signals_behaviour(void)
ft_bzero(&signal_behaviour, sizeof signal_behaviour);
signal_behaviour.sa_handler = SIG_IGN;
sigaction(SIGQUIT, &signal_behaviour, NULL);
sigaction(SIGINT, &signal_behaviour, NULL);
}