fixed double here_doc

This commit is contained in:
mdev9
2024-04-24 10:32:29 +02:00
parent 202c5e8811
commit 8becb3f468
2 changed files with 32 additions and 4 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 17:07:00 by tomoron ### ########.fr */
/* Updated: 2024/04/24 09:57:20 by marde-vr ### ########.fr */
/* */
/* ************************************************************************** */
@ -68,6 +68,12 @@ void handle_here_doc(t_msh *msh, char *eof)
int pid;
here_doc_file = get_tmp_file_name(msh);
if (msh->here_doc_filename)
{
close(msh->in_fd);
unlink(msh->here_doc_filename);
free(msh->here_doc_filename);
}
msh->here_doc_filename = here_doc_file;
msh->in_fd = open(here_doc_file, O_CREAT | O_RDWR, 0644);
if (msh->in_fd == -1)

View File

@ -1,6 +1,28 @@
unset HOME
cd | lolcat
double here_doc and manual here_doc tests
$OLDPWD and $PWD (manual tests)
$SHLVL
cat <minishell.h <<HERE <missing <<DOC | echo oi
#invalid command, followed by empty variable, should clear the exit code
doesntexist
$EMPTY
echo $?
# Should skip the empty argument, and print hello after spaces
echo - "" " " hello
Not mandatory ig? # Empty export isn't set on `env` but is set on `export`
export hello
env | grep hello
export | grep hello
test signals
test and verify all malocs
parse eof sans parse les variables
potential ft_exit that doesnt unlink tmp here_doc files
$EMPTY (manual tests)