aboutsummaryrefslogtreecommitdiffhomepage
path: root/parse_execution.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-04-02 00:32:08 -0700
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2014-04-02 00:32:08 -0700
commitb01d09d704893b59aa87308d3408c084017c46dd (patch)
treeb722583bb3a52d001ad862ca2c94a66b8549f164 /parse_execution.cpp
parent2f6551b3b129b85bccf4be1cab384243ed6defc2 (diff)
Set the job property of block_t before expanding arguments associated
with the job, fixing psub. Fixes #1394
Diffstat (limited to 'parse_execution.cpp')
-rw-r--r--parse_execution.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/parse_execution.cpp b/parse_execution.cpp
index 78baed79..d5c63aba 100644
--- a/parse_execution.cpp
+++ b/parse_execution.cpp
@@ -1383,6 +1383,9 @@ parse_execution_result_t parse_execution_context_t::run_1_job(const parse_node_t
|| is_event \
|| (!get_is_interactive()));
+ /* Tell the current block what its job is. This has to happen before we populate it (#1394) */
+ parser->current_block()->job = j;
+
/* Populate the job. This may fail for reasons like command_not_found. If this fails, an error will have been printed */
parse_execution_result_t pop_result = this->populate_job_from_job_node(j, job_node, associated_block);
@@ -1390,6 +1393,8 @@ parse_execution_result_t parse_execution_context_t::run_1_job(const parse_node_t
bool populated_job = (pop_result == parse_execution_success);
if (! populated_job || this->should_cancel_execution(associated_block))
{
+ assert(parser->current_block()->job == j);
+ parser->current_block()->job = NULL;
delete j;
j = NULL;
populated_job = false;
@@ -1406,7 +1411,6 @@ parse_execution_result_t parse_execution_context_t::run_1_job(const parse_node_t
{
/* Success. Give the job to the parser - it will clean it up. */
parser->job_add(j);
- parser->current_block()->job = j;
/* Check to see if this contained any external commands */
bool job_contained_external_command = false;