close p.to_close before redirections
This commit is contained in:
parent
9f88ed37db
commit
dec15b7ae2
4 changed files with 8 additions and 8 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/29 16:04:18 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/13 14:01:23 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/15 17:57:09 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -30,6 +30,8 @@ int process_redirect(t_process *p)
|
|||
int i;
|
||||
|
||||
redirs = p->redirs;
|
||||
if (p->to_close != STDIN)
|
||||
close(p->to_close);
|
||||
while (redirs)
|
||||
{
|
||||
redir = redirs->content;
|
||||
|
|
@ -54,8 +56,6 @@ int process_redirect(t_process *p)
|
|||
redirs = redirs->next;
|
||||
}
|
||||
/* DG("redirecting [%i:%i] [%i]", p->fdin, p->fdout, p->to_close); */
|
||||
if (p->to_close != STDIN)
|
||||
close(p->to_close);
|
||||
if (p->fdin != STDIN)
|
||||
dup2_close(p->fdin, STDIN);
|
||||
if (p->fdout != STDOUT)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/15 11:49:05 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/15 17:49:20 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/15 17:55:00 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
||||
/* Updated: 2017/03/15 16:33:07 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/15 17:55:12 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ int handle_instruction(int fd)
|
|||
return (error_syntax(&token, &parser, &ast));
|
||||
}
|
||||
}
|
||||
btree_print(STDBUG, ast, &ft_putast);
|
||||
/* btree_print(STDBUG, ast, &ft_putast); */
|
||||
if (ft_exec(&ast))
|
||||
return (2);
|
||||
instruction_free(&token, &parser, &ast);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/11 16:17:38 by ariard #+# #+# */
|
||||
/* Updated: 2017/03/13 17:42:06 by ariard ### ########.fr */
|
||||
/* Updated: 2017/03/15 17:56:56 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ int ft_parse(t_btree **ast, t_list **token, t_parser *parser)
|
|||
else
|
||||
parser->state = UNDEFINED;
|
||||
build_tree(ast, token);
|
||||
btree_print(STDBUG, *ast, &ft_putast);
|
||||
/* btree_print(STDBUG, *ast, &ft_putast); */
|
||||
if ((end_instruction(&parser->stack) && !(*token)->next))
|
||||
insert_linebreak(token);
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in a new issue