mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
Set the job property of block_t before expanding arguments associated
with the job, fixing psub. Fixes #1394
This commit is contained in:
parent
2f6551b3b1
commit
b01d09d704
3 changed files with 13 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -84,4 +84,9 @@ eval 'status -n
|
|||
status -n
|
||||
status -n'
|
||||
|
||||
# Test psub
|
||||
cat (echo foo | psub)
|
||||
cat (echo bar | psub)
|
||||
cat (echo baz | psub)
|
||||
|
||||
false
|
||||
|
|
|
@ -13,3 +13,6 @@ Testing for loop
|
|||
1
|
||||
2
|
||||
3
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
|
|
Loading…
Reference in a new issue