Fix error propagation in parser_t::eval

It was unconditionally returning `parse_execution_success`. This was
causing certain parser errors to incorrectly return after evaluation
with `$status` equal to `0`, as reported after `eval`, `source`, or
sub-`fish` execution.
This commit is contained in:
Mahmoud Al-Qudsi
2019-04-13 16:57:00 -05:00
parent 8e4010b263
commit b2a1da602f
3 changed files with 7 additions and 6 deletions

View File

@@ -631,17 +631,17 @@ int parser_t::eval(wcstring cmd, const io_chain_t &io, enum block_type_t block_t
std::fwprintf(stderr, L"%ls\n", backtrace_and_desc.c_str());
return 1;
}
this->eval(ps, io, block_type);
return 0;
return this->eval(ps, io, block_type);
}
void parser_t::eval(parsed_source_ref_t ps, const io_chain_t &io, enum block_type_t block_type) {
int parser_t::eval(parsed_source_ref_t ps, const io_chain_t &io, enum block_type_t block_type) {
assert(block_type == TOP || block_type == SUBST);
if (!ps->tree.empty()) {
// Execute the first node.
tnode_t<grammar::job_list> start{&ps->tree, &ps->tree.front()};
this->eval_node(ps, start, io, block_type, nullptr /* parent */);
return this->eval_node(ps, start, io, block_type, nullptr /* parent */);
}
return 0;
}
template <typename T>