The small fixes that were made in the corrections
This commit is contained in:
parent
81d1cc2ad1
commit
2bbd0ff867
3 changed files with 6 additions and 5 deletions
|
|
@ -59,7 +59,7 @@ void _wait_pipeline(t_vec_pid pids, t_state *state, t_pipeline_result *out)
|
||||||
if (WIFEXITED(waitpid_status))
|
if (WIFEXITED(waitpid_status))
|
||||||
out->exit = WEXITSTATUS(waitpid_status);
|
out->exit = WEXITSTATUS(waitpid_status);
|
||||||
if (WIFSIGNALED(waitpid_status))
|
if (WIFSIGNALED(waitpid_status))
|
||||||
out->exit = WTERMSIG(waitpid_status);
|
out->exit = WTERMSIG(waitpid_status) + 128;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
out->exit = 127;
|
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;
|
cpipe.create_output = i < pipeline->statements.len - 1;
|
||||||
child = pipeline->statements.buffer[i++];
|
child = pipeline->statements.buffer[i++];
|
||||||
if (child->kind == AST_COMMAND)
|
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)
|
else if (child->kind == AST_SUBSHELL)
|
||||||
ret |= _subshell_cmd(child, state, &cpipe, &pids);
|
ret = _subshell_cmd(child, state, &cpipe, &pids);
|
||||||
else
|
else
|
||||||
ret |= ((void)(printf("List in pipelines are unsupported,"\
|
ret = ((void)(printf("List in pipelines are unsupported,"\
|
||||||
" use a subshell !\n")), ERROR);
|
" use a subshell !\n")), ERROR);
|
||||||
}
|
}
|
||||||
return (_wait_pipeline(pids, state, out), ret);
|
return (_wait_pipeline(pids, state, out), ret);
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ t_error run_subshell(t_ast_subshell *subshell, t_state *state,
|
||||||
if (subshell == NULL || state == NULL || out == NULL)
|
if (subshell == NULL || state == NULL || out == NULL)
|
||||||
return (ERROR);
|
return (ERROR);
|
||||||
mem_set_zero(&sinfo, sizeof(sinfo));
|
mem_set_zero(&sinfo, sizeof(sinfo));
|
||||||
|
mem_set_zero(&info, sizeof(info));
|
||||||
sinfo.state = state;
|
sinfo.state = state;
|
||||||
if (_setup_redirection(&info, state, cmd_pipe, \
|
if (_setup_redirection(&info, state, cmd_pipe, \
|
||||||
&subshell->suffixes_redirections))
|
&subshell->suffixes_redirections))
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ t_error get_user_input(t_state *state)
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
lstate.pos = 0;
|
lstate.pos = 0;
|
||||||
state->last_exit = 127;
|
state->last_exit = 130;
|
||||||
string_clear(&lstate.buf);
|
string_clear(&lstate.buf);
|
||||||
write_fd(lstate.output_fd, (void *)"^C\n", 3, NULL);
|
write_fd(lstate.output_fd, (void *)"^C\n", 3, NULL);
|
||||||
line_refresh_line(&lstate);
|
line_refresh_line(&lstate);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue