The small fixes that were made in the corrections

This commit is contained in:
maix0 2024-10-16 22:12:45 +02:00
parent 81d1cc2ad1
commit 2bbd0ff867
3 changed files with 6 additions and 5 deletions

View file

@ -59,7 +59,7 @@ void _wait_pipeline(t_vec_pid pids, t_state *state, t_pipeline_result *out)
if (WIFEXITED(waitpid_status))
out->exit = WEXITSTATUS(waitpid_status);
if (WIFSIGNALED(waitpid_status))
out->exit = WTERMSIG(waitpid_status);
out->exit = WTERMSIG(waitpid_status) + 128;
}
else
out->exit = 127;
@ -131,11 +131,11 @@ t_error run_pipeline(t_ast_pipeline *pipeline, t_state *state,
cpipe.create_output = i < pipeline->statements.len - 1;
child = pipeline->statements.buffer[i++];
if (child->kind == AST_COMMAND)
ret |= _pipeline_cmd(child, state, &cpipe, &pids);
ret = _pipeline_cmd(child, state, &cpipe, &pids);
else if (child->kind == AST_SUBSHELL)
ret |= _subshell_cmd(child, state, &cpipe, &pids);
ret = _subshell_cmd(child, state, &cpipe, &pids);
else
ret |= ((void)(printf("List in pipelines are unsupported,"\
ret = ((void)(printf("List in pipelines are unsupported,"\
" use a subshell !\n")), ERROR);
}
return (_wait_pipeline(pids, state, out), ret);

View file

@ -96,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));
mem_set_zero(&info, sizeof(info));
sinfo.state = state;
if (_setup_redirection(&info, state, cmd_pipe, \
&subshell->suffixes_redirections))

View file

@ -41,7 +41,7 @@ t_error get_user_input(t_state *state)
{
errno = 0;
lstate.pos = 0;
state->last_exit = 127;
state->last_exit = 130;
string_clear(&lstate.buf);
write_fd(lstate.output_fd, (void *)"^C\n", 3, NULL);
line_refresh_line(&lstate);