aboutsummaryrefslogtreecommitdiffhomepage
path: root/parse_execution.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-01-02 12:37:50 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-01-02 16:19:33 -0800
commit993148552efcffb60c7e1be7aa3322f1bffa1c74 (patch)
treeefdbd68e79c93f3b25b7d69c6a7f8a6d0ff7a903 /parse_execution.cpp
parent1863be7be43d18e5e24c2684df86d764ddb089cc (diff)
Support for Ctrl-C cancellation in new parser. Added tests for it too.
Diffstat (limited to 'parse_execution.cpp')
-rw-r--r--parse_execution.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/parse_execution.cpp b/parse_execution.cpp
index bc478c05..8ca50d56 100644
--- a/parse_execution.cpp
+++ b/parse_execution.cpp
@@ -173,6 +173,10 @@ parse_execution_context_t::execution_cancellation_reason_t parse_execution_conte
{
return execution_cancellation_exit;
}
+ else if (parser && parser->cancellation_requested)
+ {
+ return execution_cancellation_skip;
+ }
else if (block && block->loop_status != LOOP_NORMAL)
{
/* Nasty hack - break and continue set the 'skip' flag as well as the loop status flag. */
@@ -1241,12 +1245,14 @@ parse_execution_result_t parse_execution_context_t::run_1_job(const parse_node_t
/* Clean up the job on failure or cancellation */
bool populated_job = (pop_result == parse_execution_success);
- if (! populated_job)
+ if (! populated_job || this->should_cancel_execution(associated_block))
{
delete j;
j = NULL;
+ populated_job = false;
}
+
/* Store time it took to 'parse' the command */
if (do_profile)
{