gysiang / minishell

0 stars 1 forks source link

2 Exit Status broke #220

Closed gysiang closed 4 months ago

gysiang commented 4 months ago

Test 40: ❌ cd $PWD hi mini exit code = 0 bash exit code = 1 mini error = () bash error = ( too many arguments) Test 41: ❌ cd 123123 mini exit code = 0 bash exit code = 1 mini error = () bash error = ( No such file or directory)

This was the function that caused it @axellee1994

void    execute_builtin_or_exec(t_token *curr, t_shell *minishell)
{
    pid_t   pid;

    if (minishell->prev_fd != 1)
        close(minishell->prev_fd);
    if (ft_strncmp(curr->token, "echo", 4) == 0)
    {
        pid = fork();
        if (pid == 0)
        {
            execute_builtin_1(curr, minishell);
            exit(0);
        }
        else
            minishell->process_ids[minishell->process_count++] = pid;
    }
    else
    {
        execute_builtin_2(curr, minishell);
        other_cmds(curr, minishell);
    }
}
axellee1994 commented 4 months ago

@gysiang Resolved in the latest pull request.