Fix status when function/block evaluation is cancelled

It looks like the last status already contains the signal that cancelled
execution.

Also make `fish -c something` always return the last exit status of
"something", instead of hardcoded 127 if exited or signalled.

Fixes #6444
This commit is contained in:
Johannes Altmanninger
2019-12-23 13:49:40 +01:00
parent 8ca936aea6
commit 9f48fc6285
3 changed files with 17 additions and 12 deletions

View File

@@ -737,10 +737,8 @@ static proc_performer_t get_performer_for_process(process_t *p, const job_t *job
switch (res) {
case eval_result_t::ok:
case eval_result_t::error:
return proc_status_t::from_exit_code(parser.get_last_status());
case eval_result_t::cancelled:
// TODO: we should reflect the actual signal which was received.
return proc_status_t::from_signal(SIGINT);
return proc_status_t::from_exit_code(parser.get_last_status());
case eval_result_t::control_flow:
default:
DIE("eval_result_t::control_flow should not be returned from eval_node");
@@ -768,11 +766,8 @@ static proc_performer_t get_performer_for_process(process_t *p, const job_t *job
? EXIT_SUCCESS
: parser.get_last_status());
case eval_result_t::error:
return proc_status_t::from_exit_code(parser.get_last_status());
case eval_result_t::cancelled:
// TODO: we should reflect the actual signal which was received.
return proc_status_t::from_signal(SIGINT);
return proc_status_t::from_exit_code(parser.get_last_status());
default:
case eval_result_t::control_flow:
DIE("eval_result_t::control_flow should not be returned from eval_node");