diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-09-10 19:46:07 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-09-10 20:32:25 +0200 |
| commit | 98990d5195e93154abbfd16eaa9d1fcc3572bc5c (patch) | |
| tree | 110a4cedf6ada1281cdc356b21ebe2b55acec32a /src/eval/op.c | |
| parent | b16d4b834d95d5cc0757d09e74fe6042e55f5440 (diff) | |
| download | minishell-98990d5195e93154abbfd16eaa9d1fcc3572bc5c.tar.gz minishell-98990d5195e93154abbfd16eaa9d1fcc3572bc5c.tar.bz2 minishell-98990d5195e93154abbfd16eaa9d1fcc3572bc5c.zip | |
Added errorf_ret helper, Removing error to status (just status code and fatal error)
Diffstat (limited to 'src/eval/op.c')
| -rw-r--r-- | src/eval/op.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/eval/op.c b/src/eval/op.c index e06c959..9a37736 100644 --- a/src/eval/op.c +++ b/src/eval/op.c @@ -6,7 +6,7 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/17 15:27:22 by charles #+# #+# */ -/* Updated: 2020/09/10 14:15:08 by charles ### ########.fr */ +/* Updated: 2020/09/10 20:28:57 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -29,8 +29,9 @@ int eval_op(int fds[2], t_env env, t_path path, t_ast *ast) left_fds[FD_WRITE] = p[FD_WRITE]; right_fds[FD_READ] = p[FD_READ]; } - if ((status = eval(left_fds, env, path, ast->op.left)) == -1) - return (-1); + if ((status = eval(left_fds, env, path, ast->op.left)) == EVAL_FATAL) + return (EVAL_FATAL); + g_last_status = status; if ((ast->op.sep == TAG_AND && status != 0) || (ast->op.sep == TAG_PIPE && status != 0) || (ast->op.sep == TAG_OR && status == 0)) @@ -49,9 +50,10 @@ int wrapped_eval(void *void_param) int eval_parent(int fds[2], t_env env, t_path path, t_ast *ast) { t_fork_param_parent param; + int status; - if (!redir_extract(&ast->redirs, env, fds)) - return (ERR_FATAL); + if ((status = redir_extract(&ast->redirs, env, fds)) != 0) + return (status); param.fds[0] = fds[0]; param.fds[1] = fds[1]; param.env = env; @@ -69,5 +71,5 @@ int eval(int fds[2], t_env env, t_path path, t_ast *ast) return (eval_op(fds, env, path, ast)); if (ast->tag == AST_CMD) return (eval_cmd(fds, env, path, ast)); - return (ERR_FATAL); + return (EVAL_FATAL); } |
