env ./42sh still making problems
This commit is contained in:
parent
b1f730a833
commit
9e8855a9ef
3 changed files with 5 additions and 6 deletions
|
|
@ -140,7 +140,7 @@ struct s_exec
|
|||
};
|
||||
|
||||
int exec_reset(void);
|
||||
int do_the_muther_forker(t_process *p);
|
||||
int process_fork(t_process *p);
|
||||
int process_setgroup(t_process *p, pid_t pid);
|
||||
void process_setsig(void);
|
||||
void process_reset(t_process *p);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ int process_launch(t_process *p)
|
|||
process_free(p, 0);
|
||||
return (1);
|
||||
}
|
||||
p->pid = process_fork(p):
|
||||
p->pid = process_fork(p);
|
||||
process_setgroup(p, p->pid);
|
||||
if (p->fdin != STDIN)
|
||||
close(p->fdin);
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ static char *manage_output(int *fds)
|
|||
|
||||
output = NULL;
|
||||
close(fds[PIPE_WRITE]);
|
||||
while ((ret = read(fds[PIPE_READ], buf, BUF_SIZE)) > 0)
|
||||
{
|
||||
while ((ret = read(fds[PIPE_READ], buf, BUF_SIZE)) > 0) {
|
||||
buf[ret] = 0;
|
||||
ft_strappend(&output, buf);
|
||||
}
|
||||
|
|
@ -89,7 +88,7 @@ char *command_getoutput(char *command)
|
|||
if (!command)
|
||||
return (NULL);
|
||||
pipe(fds);
|
||||
if (!(pid = do_the_muther_forker(NULL)))
|
||||
if (!(pid = process_fork(NULL)))
|
||||
{
|
||||
close(fds[PIPE_READ]);
|
||||
dup2_close(fds[PIPE_WRITE], STDOUT);
|
||||
|
|
@ -110,7 +109,7 @@ int command_setoutput(char *const av[], char **env)
|
|||
if (!av)
|
||||
return (0);
|
||||
pid = 0;
|
||||
if (!(pid = do_the_muther_forker(NULL)))
|
||||
if (!(pid = process_fork(NULL)))
|
||||
execute_command(av, env);
|
||||
return (pid);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue