Express cancellation as a possible result of expand_string

This allows us to properly thread control-C signals from command
substitutions into the expanding string.
This commit is contained in:
ridiculousfish
2020-01-22 11:58:10 -08:00
parent 8a9c39d433
commit e640a01ea5
4 changed files with 19 additions and 1 deletions

View File

@@ -465,6 +465,9 @@ eval_result_t parse_execution_context_t::run_switch_statement(
case expand_result_t::error:
return report_errors(errors);
case expand_result_t::cancel:
return eval_result_t::cancelled;
case expand_result_t::wildcard_no_match:
return report_unmatched_wildcard_error(switch_value_n);
@@ -874,6 +877,9 @@ eval_result_t parse_execution_context_t::expand_arguments_from_nodes(
case expand_result_t::error: {
return this->report_errors(errors);
}
case expand_result_t::cancel: {
return eval_result_t::cancelled;
}
case expand_result_t::wildcard_no_match: {
if (glob_behavior == failglob) {
// Report the unmatched wildcard error and stop processing.
@@ -1023,6 +1029,9 @@ eval_result_t parse_execution_context_t::apply_variable_assignments(
this->report_errors(errors);
return eval_result_t::error;
}
case expand_result_t::cancel: {
return eval_result_t::cancelled;
}
case expand_result_t::wildcard_no_match: // nullglob (equivalent to set)
case expand_result_t::ok: {
break;