From ebc262cfbaf8ded7a2de5c10ad7ac622d814a733 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Tue, 17 Dec 2019 16:41:10 -0800 Subject: [PATCH] Fix sporadic cancellation test failures If a Control-C is received during expanding a command substitution, we may execute the job anyways, because we do not check for cancellation after the expansion. Ensure that does not happen. This should fix sporadic test failures in the cancellation unit test. --- src/parse_execution.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/parse_execution.cpp b/src/parse_execution.cpp index d707c4164..de5007b17 100644 --- a/src/parse_execution.cpp +++ b/src/parse_execution.cpp @@ -926,6 +926,11 @@ parse_execution_result_t parse_execution_context_t::expand_arguments_from_nodes( } } + // We may have received a cancellation during this expansion. + if (parser->cancellation_requested) { + return parse_execution_cancelled; + } + return parse_execution_success; }