Eliminate the job from block_t

This exists only to support the '--on-job-exit caller' feature.
Just store the calling job ID directly in the parser's libdata.
This commit is contained in:
ridiculousfish
2019-05-12 14:42:18 -07:00
parent 6e0cf5db6f
commit 5158ee812b
4 changed files with 15 additions and 25 deletions

View File

@@ -93,19 +93,7 @@ static int parse_cmd_opts(function_cmd_opts_t &opts, int *optind, //!OCLINT(hig
job_id_t job_id = -1;
if (is_subshell) {
size_t block_idx = 0;
// Find the outermost substitution block.
for (block_idx = 0;; block_idx++) {
const block_t *b = parser.block_at_index(block_idx);
if (b == NULL || b->type() == SUBST) break;
}
// Go one step beyond that, to get to the caller.
const block_t *caller_block = parser.block_at_index(block_idx + 1);
if (caller_block != NULL && caller_block->job != NULL) {
job_id = caller_block->job->job_id;
}
job_id = parser.libdata().caller_job_id;
}
if (job_id == -1) {