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

@@ -249,16 +249,14 @@ static int read_init(const struct config_paths_t &paths) {
}
int run_command_list(std::vector<std::string> *cmds, const io_chain_t &io) {
int res = 1;
parser_t &parser = parser_t::principal_parser();
for (const auto &cmd : *cmds) {
const wcstring cmd_wcs = str2wcstring(cmd);
eval_result_t eval_res = parser.eval(cmd_wcs, io);
res = (eval_res == eval_result_t::ok ? 0 : 1);
parser.eval(cmd_wcs, io);
}
return res;
return 0;
}
/// Parse the argument list, return the index of the first non-flag arguments.