des trucs

This commit is contained in:
2024-04-23 17:03:30 +02:00
parent 905bbc659b
commit 2d8624d221
5 changed files with 20 additions and 19 deletions

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/24 17:44:32 by marde-vr #+# #+# */
/* Updated: 2024/04/23 16:41:42 by tomoron ### ########.fr */
/* Updated: 2024/04/23 16:59:17 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -38,13 +38,10 @@ void get_here_doc_input(t_msh *msh, char *eof)
void here_doc_child(t_msh *msh, char *eof, char *here_doc_file)
{
here_doc_variables(1, 0, msh);
here_doc_variables(1, 1, here_doc_file);
here_doc_variables(1, msh);
signal(SIGINT, signal_handler_here_doc);
get_here_doc_input(msh, eof);
close(msh->in_fd);
printf("close2");
free(here_doc_file);
ft_exit(msh, 0);
}
@ -58,11 +55,9 @@ void here_doc_signal(t_msh *msh, int child_pid, char *here_doc_file)
signal(SIGINT, signal_handler_interactive);
signal(SIGQUIT, signal_handler_interactive);
close(msh->in_fd);
printf("close 1\n");
if (WIFEXITED(status) && WEXITSTATUS(status))
unlink(here_doc_file);
msh->in_fd = open(here_doc_file, O_RDWR, 0644);
free(here_doc_file);
if (msh->in_fd == -1 && !(WIFEXITED(status) && WEXITSTATUS(status)))
perror("open");
}
@ -73,6 +68,7 @@ void handle_here_doc(t_msh *msh, char *eof)
int pid;
here_doc_file = get_tmp_file_name(msh);
msh->here_doc_filename = here_doc_file;
msh->in_fd = open(here_doc_file, O_CREAT | O_RDWR, 0644);
if (msh->in_fd == -1)
{