mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-04 01:25:25 +08:00
Don't give job IDs to block processes either
Extend the commit 8e17d29e04ee to block processes, for example: begin ; stuff ; end or if/while blocks as well. Note there's an existing optimization where we do not create a job for a block if it has no redirections.
This commit is contained in:
parent
a6e5583b5b
commit
b691d3130e
15
src/exec.cpp
15
src/exec.cpp
@ -714,13 +714,6 @@ static proc_performer_t get_performer_for_process(process_t *p, job_t *job,
|
||||
};
|
||||
} else {
|
||||
assert(p->type == process_type_t::function);
|
||||
// If this function is the only process in the current job
|
||||
// and that job is in the foreground then mark this job as internal
|
||||
// so it doesn't increment the job id for any jobs created within this
|
||||
// function.
|
||||
if (p->is_first_in_job && p->is_last_in_job && job->flags().foreground) {
|
||||
job->mark_internal();
|
||||
}
|
||||
auto props = function_get_properties(p->argv0());
|
||||
if (!props) {
|
||||
FLOGF(error, _(L"Unknown function '%ls'"), p->argv0());
|
||||
@ -771,6 +764,14 @@ static bool exec_block_or_func_process(parser_t &parser, const std::shared_ptr<j
|
||||
io_chain.push_back(block_output_bufferfill);
|
||||
}
|
||||
|
||||
// If this function is the only process in the current job
|
||||
// and that job is in the foreground then mark this job as internal
|
||||
// so it doesn't increment the job id for any jobs created within this
|
||||
// function.
|
||||
if (p->is_first_in_job && p->is_last_in_job && j->flags().foreground) {
|
||||
j->mark_internal();
|
||||
}
|
||||
|
||||
// Get the process performer, and just execute it directly.
|
||||
// Do it in this scoped way so that the performer function can be eagerly deallocating releasing
|
||||
// its captured io chain.
|
||||
|
@ -10,16 +10,15 @@ function func100
|
||||
sleep 100 &
|
||||
set -g tokill $tokill $last_pid
|
||||
end
|
||||
func100
|
||||
|
||||
function func200
|
||||
# The redirection ensures this becomes a real job.
|
||||
begin
|
||||
sleep 200 &
|
||||
set -g tokill $tokill $last_pid
|
||||
end
|
||||
end </dev/null
|
||||
|
||||
|
||||
func100
|
||||
func200
|
||||
|
||||
sleep 300 &
|
||||
set -g tokill $tokill $last_pid
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user