update: tried to fix $?, the error is in the int_to_str stuff
This commit is contained in:
parent
a567a5323b
commit
bac90251fe
8 changed files with 23 additions and 11 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/14 12:31:28 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/10/06 14:22:08 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/10/10 18:54:14 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -56,6 +56,7 @@ t_error _run_other(t_ast_node self, t_state *state, int *out)
|
|||
*out = subshell_res.exit;
|
||||
}
|
||||
state->last_exit = *out;
|
||||
printf("state->last_exit = %i\n", state->last_exit);
|
||||
return (NO_ERROR);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/14 12:24:49 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/10/10 16:25:43 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/10/10 18:56:40 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -117,6 +117,7 @@ t_error _handle_builtin(t_spawn_info info, t_state *state, t_cmd_pipe cmd_pipe,
|
|||
return (ERROR);
|
||||
if (_setup_binfo(&info, &binfo, out))
|
||||
return (ERROR);
|
||||
printf("last_exit = %i\n", state->last_exit);
|
||||
_run_builtin(&binfo, actual_func, cmd_pipe, out);
|
||||
if (binfo.stdin)
|
||||
close_fd(binfo.stdin);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/14 12:38:38 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/10/06 14:28:10 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/10/10 18:58:52 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -54,7 +54,8 @@ t_error _run_expansion_special_var(t_ast_expansion *self, t_state *state,
|
|||
if (name == '?')
|
||||
{
|
||||
*out = (t_expansion_result){.exists = true, .value = NULL};
|
||||
if (i32_to_str(state->last_exit, &out->value))
|
||||
printf("state->last_exit in exp = %i \n", state->last_exit);
|
||||
if (i32_to_str(state->last_exit, &out->value)) // TODO: fix this shit
|
||||
return (ERROR);
|
||||
}
|
||||
if (name == '#')
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/09/14 12:35:02 by maiboyer #+# #+# */
|
||||
/* Updated: 2024/10/10 16:31:30 by maiboyer ### ########.fr */
|
||||
/* Updated: 2024/10/10 18:52:39 by maiboyer ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -81,6 +81,8 @@ t_error _wait_subshell(\
|
|||
out->exit = WEXITSTATUS(status);
|
||||
if (WIFSIGNALED(status))
|
||||
out->exit = WTERMSIG(status);
|
||||
printf("out->exit for subshell is %i\n", out->exit);
|
||||
sinfo.state->last_exit = out->exit;
|
||||
return (NO_ERROR);
|
||||
}
|
||||
|
||||
|
|
@ -94,6 +96,7 @@ t_error run_subshell(t_ast_subshell *subshell, t_state *state,
|
|||
if (subshell == NULL || state == NULL || out == NULL)
|
||||
return (ERROR);
|
||||
mem_set_zero(&sinfo, sizeof(sinfo));
|
||||
sinfo.state = state;
|
||||
if (_setup_redirection(&info, state, cmd_pipe, \
|
||||
&subshell->suffixes_redirections))
|
||||
return (ERROR);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue