segfault on 'builtin | binary' fixed, 'binary | builtin' gets a SIGKILL somehow...
This commit is contained in:
parent
694744bf0c
commit
56fe780999
4 changed files with 7 additions and 4 deletions
|
|
@ -22,7 +22,7 @@ int exec_pipe(t_btree **ast)
|
|||
data = data_singleton();
|
||||
p = &data_singleton()->exec.process;
|
||||
pipe(fds);
|
||||
DG("pipe %i->%i", fds[PIPE_WRITE], fds[PIPE_READ]);
|
||||
/* DG("pipe %i->%i", fds[PIPE_WRITE], fds[PIPE_READ]); */
|
||||
p->fdout = fds[PIPE_WRITE];
|
||||
start = IS_PIPESTART(p->attributes);
|
||||
p->toclose = fds[PIPE_READ];
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ int launch_process(t_process *p)
|
|||
int pid;
|
||||
|
||||
exec = &data_singleton()->exec;
|
||||
DG("launching");
|
||||
if (p->attributes & PROCESS_UNKNOWN)
|
||||
{
|
||||
ft_dprintf(2, "{red}%s: command not found: %s{eoc}\n", SHELL_NAME, p->av[0]);
|
||||
|
|
@ -26,7 +25,6 @@ int launch_process(t_process *p)
|
|||
}
|
||||
else if (p->attributes & PROCESS_BUILTIN && IS_PIPESINGLE(p->attributes))
|
||||
{
|
||||
DG("check 0");
|
||||
if (process_redirect(p))
|
||||
return (1);
|
||||
set_exitstatus((*p->execf)(p->path, p->av, data_singleton()->env), 1);
|
||||
|
|
@ -42,7 +40,6 @@ int launch_process(t_process *p)
|
|||
set_exitstatus(126, 1);
|
||||
return (1);
|
||||
}
|
||||
DG("gonna fork now");
|
||||
pid = fork();
|
||||
if (pid == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
int process_setexec(t_type type, t_process *p)
|
||||
{
|
||||
p->path = NULL;
|
||||
if (type == TK_SUBSHELL)
|
||||
{
|
||||
p->execf = &execve;
|
||||
|
|
@ -21,7 +22,9 @@ int process_setexec(t_type type, t_process *p)
|
|||
p->path = ft_strdup(p->av[0]);
|
||||
}
|
||||
else if ((p->execf = is_builtin(p)))
|
||||
{
|
||||
p->attributes |= PROCESS_BUILTIN;
|
||||
}
|
||||
else if (ft_strchr(p->av[0], '/'))
|
||||
{
|
||||
p->execf = &execve;
|
||||
|
|
|
|||
|
|
@ -26,8 +26,11 @@ int put_job_in_foreground(t_job *j, int cont)
|
|||
if (kill(-j->pgid, SIGCONT) < 0)
|
||||
DG("kill(SIGCONT) failed");
|
||||
}
|
||||
DG("check 00");
|
||||
job_wait(j->id);
|
||||
DG("check 01");
|
||||
job_remove(j->id);
|
||||
DG("check 02");
|
||||
|
||||
tcsetpgrp(STDIN, jobc->shell_pgid);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue