Commit a36328d9 authored by abenoit's avatar abenoit
Browse files

exit arg stop exec

parent b02eb37e
......@@ -22,8 +22,6 @@ int ft_exit(char **args, t_xe *xe)
xe->stat_loc = 1;
if (!(xe->flags & RUN))
xe->flags += RUN;
if (xe->flags & EXIT_FLAG)
xe->flags -= EXIT_FLAG;
return (EXIT_ARG_ERR);
}
xe->stat_loc = (unsigned int)ft_atoi(args[1]) % 256;
......
......@@ -91,6 +91,8 @@ int parent_pipe_end(t_command *cur_command, t_xe *xe, int fd_in, int proc)
xe->flags = RUN;
xe->stat_loc = tmp;
ft_error(ret, xe);
if (ret == EXIT_ARG_ERR)
return (SUCCESS);
return (handle_execution(xe, STDIN_FILENO, 0));
}
}
......
......@@ -74,14 +74,6 @@ int clean_and_exit(int err_code, t_xe *xe)
{
int ret;
if (isatty(STDIN_FILENO) && (xe->flags & EXIT_FLAG)) // temp pour le testeur
{
if (!(xe->flags & CHILD))
{
if (ft_putstr_fd("exit\n", STDOUT_FILENO) != WRITE_SUCCESS)
return (WRITE_ERR); // possible?
}
}
if (err_code == ARG_ERR)
{
ret = 1;
......@@ -116,6 +108,14 @@ int clean_and_exit(int err_code, t_xe *xe)
int ft_error(int ret, t_xe *xe)
{
if (xe->flags & EXIT_FLAG) // temp pour le testeur
{
//if (!(xe->flags & CHILD))
// {
if (ft_putstr_fd("exit\n", STDOUT_FILENO) != WRITE_SUCCESS)
return (WRITE_ERR); // possible?
// }
}
if (ret == PIPE_EXIT)
{
xe->flags = RUN;
......
Markdown is supported
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