fds and sigint
This commit is contained in:
@@ -65,6 +65,10 @@ int exec(t_ast_n *node)
|
||||
char *path;
|
||||
|
||||
expand_node(node);
|
||||
if (node->msh->here_fd != -1)
|
||||
close(node->msh->here_fd);
|
||||
if (node->msh->hist != -1)
|
||||
close(node->msh->hist);
|
||||
path = find_path(node->cmd, node->msh->env);
|
||||
if (!path)
|
||||
return_error(node->cmd, "command not found", 127, node);
|
||||
|
||||
@@ -16,6 +16,13 @@ void exec_pcmd(t_ast_n *pcmd)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (pcmd->msh->here_fd != -1)
|
||||
close(pcmd->msh->here_fd);
|
||||
close(pcmd->msh->hist);
|
||||
if (pcmd->save_stdo != -1)
|
||||
close(pcmd->save_stdo);
|
||||
if (pcmd->save_stdi != -1)
|
||||
close(pcmd->save_stdi);
|
||||
if (!pcmd->cmd)
|
||||
exit(0);
|
||||
if (is_builtin(pcmd->cmd))
|
||||
@@ -35,7 +42,6 @@ void exec_pchild(int *pipes, int index, t_ast_n *pcmd, int cmds)
|
||||
ret = 0;
|
||||
if (index < cmds - 1)
|
||||
dup2(pipes[1], STDOUT_FILENO);
|
||||
close(pcmd->msh->hist);
|
||||
close(pipes[0]);
|
||||
close(pipes[1]);
|
||||
handle_redir(pcmd);
|
||||
|
||||
Reference in New Issue
Block a user