save the PID!
This commit is contained in:
parent
727935ea08
commit
3cba7c5341
@ -18,6 +18,8 @@ int is_builtin(char *cmd)
|
||||
"unset", "env", "exit", NULL};
|
||||
int i;
|
||||
|
||||
if (cmd == NULL)
|
||||
return (-1);
|
||||
i = 0;
|
||||
while (builtins[i])
|
||||
{
|
||||
|
||||
@ -34,12 +34,13 @@ static int execute_builtin(t_minishell *msh, t_command *cmd)
|
||||
return (exit_status);
|
||||
}
|
||||
|
||||
static void executor_execute_command(t_minishell *msh, t_command *cmd)
|
||||
static int executor_execute_command(t_minishell *msh, t_command *cmd)
|
||||
{
|
||||
if (cmd->args[0] != NULL && is_builtin(cmd->args[0]) >= 0)
|
||||
if (is_builtin(cmd->args[0]) >= 0)
|
||||
msh->exit_status = execute_builtin(msh, cmd);
|
||||
else if (cmd->args[0] != NULL)
|
||||
executor_fork(msh, cmd);
|
||||
return (executor_fork(msh, cmd));
|
||||
return (0);
|
||||
}
|
||||
|
||||
int executor_execute_pipeline(t_minishell *msh)
|
||||
@ -55,7 +56,7 @@ int executor_execute_pipeline(t_minishell *msh)
|
||||
last_pid = 0;
|
||||
while (current)
|
||||
{
|
||||
executor_execute_command(msh, (t_command *)current->content);
|
||||
last_pid = executor_execute_command(msh, (t_command *)current->content);
|
||||
current = current->next;
|
||||
}
|
||||
if (last_pid != 0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user