Commit c818ef25 authored by abenoit's avatar abenoit
Browse files

redir error output

parent dd259218
......@@ -26,20 +26,19 @@ echo > $unknown_var ; ls ; ls (redir ambigue mais il fait quand meme ls)
=======================Resolu
create file when redirecting output without doing anything ("> a")
====================
====================Strerror added
error when redir_in file does not exist ("< unknown_file")
====================Strerror added
error when redir_out file does not have write permission
compare with bash: "cat | exit"
"cat |"
then "ls"
compare with bash: "cat | exit"======>ne devrait pas exit
check_syntax:
echo "'"
echo '\'
echo '"'
"cat |"======>multiline error
......
#include "execution.h"
#include "builtins.h"
#include <string.h>
static int launch_exit(char **args, t_xe *xe)
{
......@@ -219,6 +220,12 @@ void apply_redir(char *cur_arg, enum e_redir_op redir)
{
dup2(redir_fd, src_fd); // error
}
else
{
ft_putstr_fd(cur_arg, STDERR_FILENO);
ft_putstr_fd(": ", STDERR_FILENO);
ft_putstr_fd(strerror(errno), STDERR_FILENO);
}
}
void apply_redirs(char **redir_paths, enum e_redir_op *redir_types)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment