file perm error

This commit is contained in:
Loic Deridder
2025-02-13 15:41:12 +01:00
parent bee6feb644
commit fbcc5403f2
7 changed files with 94 additions and 38 deletions

View File

@@ -12,20 +12,25 @@
#include "../../includes/minishell.h"
static int execute_and(t_ast_n *node)
{
node->msh->ex_code = execute_command(node->left);
if (node->msh->ex_code == 0)
node->msh->ex_code = execute_command(node->right);
return (node->msh->ex_code);
}
int execute_command(t_ast_n *node)
{
if (!node || (node->state == _CMD && node->cmd == NULL))
return (0);
if (node->state == _CMD)
handle_redir(node);
if (handle_redir(node))
return (1);
if (node->state == _CMD)
node->msh->ex_code = exec_scmd(node);
else if (node->state == _AND)
{
node->msh->ex_code = execute_command(node->left);
if (node->msh->ex_code == 0)
node->msh->ex_code = execute_command(node->right);
}
node->msh->ex_code = execute_and(node);
else if (node->state == _OR)
{
node->msh->ex_code = execute_command(node->left);