mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 19:03:38 +08: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
|
@ -1383,6 +1383,9 @@ parse_execution_result_t parse_execution_context_t::run_1_job(const parse_node_t
|
||||||
|| is_event \
|
|| is_event \
|
||||||
|| (!get_is_interactive()));
|
|| (!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 */
|
/* 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);
|
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);
|
bool populated_job = (pop_result == parse_execution_success);
|
||||||
if (! populated_job || this->should_cancel_execution(associated_block))
|
if (! populated_job || this->should_cancel_execution(associated_block))
|
||||||
{
|
{
|
||||||
|
assert(parser->current_block()->job == j);
|
||||||
|
parser->current_block()->job = NULL;
|
||||||
delete j;
|
delete j;
|
||||||
j = NULL;
|
j = NULL;
|
||||||
populated_job = false;
|
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. */
|
/* Success. Give the job to the parser - it will clean it up. */
|
||||||
parser->job_add(j);
|
parser->job_add(j);
|
||||||
parser->current_block()->job = j;
|
|
||||||
|
|
||||||
/* Check to see if this contained any external commands */
|
/* Check to see if this contained any external commands */
|
||||||
bool job_contained_external_command = false;
|
bool job_contained_external_command = false;
|
||||||
|
|
|
@ -84,4 +84,9 @@ eval 'status -n
|
||||||
status -n
|
status -n
|
||||||
status -n'
|
status -n'
|
||||||
|
|
||||||
|
# Test psub
|
||||||
|
cat (echo foo | psub)
|
||||||
|
cat (echo bar | psub)
|
||||||
|
cat (echo baz | psub)
|
||||||
|
|
||||||
false
|
false
|
||||||
|
|
|
@ -13,3 +13,6 @@ Testing for loop
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
3
|
3
|
||||||
|
foo
|
||||||
|
bar
|
||||||
|
baz
|
||||||
|
|
Loading…
Reference in New Issue
Block a user