further subshell/brace launch re-design
This commit is contained in:
parent
97a0a0f53f
commit
65ef17b62c
2 changed files with 8 additions and 29 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/13 19:09:30 by jhalford #+# #+# */
|
/* Created: 2017/03/13 19:09:30 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/13 23:59:04 by jhalford ### ########.fr */
|
/* Updated: 2017/03/14 00:03:01 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,37 +14,14 @@
|
||||||
|
|
||||||
int plaunch_brace(t_process *p)
|
int plaunch_brace(t_process *p)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
|
||||||
|
|
||||||
DG("plaunch_brace");
|
|
||||||
if (IS_PIPESINGLE(*p))
|
if (IS_PIPESINGLE(*p))
|
||||||
{
|
{
|
||||||
if (process_redirect(p))
|
if (process_redirect(p))
|
||||||
{
|
|
||||||
DG("BRACE_GROUP redirection failed");
|
|
||||||
set_exitstatus(1, 1);
|
set_exitstatus(1, 1);
|
||||||
return (0);
|
else
|
||||||
}
|
|
||||||
ft_exec(&p->data.brace.content);
|
ft_exec(&p->data.brace.content);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
pid = fork();
|
else
|
||||||
if (pid == 0)
|
return (plaunch_subshell(p))
|
||||||
{
|
|
||||||
DG("fork!");
|
|
||||||
data_singleton()->opts &= ~SH_INTERACTIVE;
|
|
||||||
data_singleton()->opts &= ~SH_OPTS_JOBC;
|
|
||||||
if (process_redirect(p))
|
|
||||||
exit (1);
|
|
||||||
process_setgroup(p, 0);
|
|
||||||
process_setsig();
|
|
||||||
exec_reset();
|
|
||||||
ft_exec(&p->data.brace.content);
|
|
||||||
exit(ft_atoi(ft_getenv(data_singleton()->env, "?")));
|
|
||||||
}
|
|
||||||
else if (pid > 0)
|
|
||||||
return (pid);
|
|
||||||
else if (pid == -1)
|
|
||||||
ft_dprintf(2, "{red}%s: internal fork error{eoc}\n", SHELL_NAME);
|
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/08 00:11:44 by wescande #+# #+# */
|
/* Created: 2017/03/08 00:11:44 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/13 23:59:10 by jhalford ### ########.fr */
|
/* Updated: 2017/03/14 00:00:26 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -31,5 +31,7 @@ int plaunch_subshell(t_process *p)
|
||||||
}
|
}
|
||||||
else if (pid > 0)
|
else if (pid > 0)
|
||||||
return (pid);
|
return (pid);
|
||||||
|
else if (pid == -1)
|
||||||
|
ft_dprintf(2, "{red}%s: internal fork error{eoc}\n", SHELL_NAME);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue