2024-04-12 18:19:32 +08:00
|
|
|
# RUN: %fish %s
|
Correct reordering of jobs in job_promote
job_promote attempts to bring the most recently "touched" job to the front
of the job list. It did this via:
std::rotate(begin, job, end)
However this has the effect of pushing job-1 to the end. That is,
promoting '2' in [1, 2, 3] would result in [2, 3, 1].
Correct this by replacing it with:
std::rotate(begin, job, job+1);
now we get the desired [2, 1, 3].
Also add a test.
2020-01-01 04:41:11 +08:00
|
|
|
|
|
|
|
# Ensure that job IDs are sequential.
|
|
|
|
|
|
|
|
status job-control full
|
|
|
|
|
|
|
|
set -g tokill
|
|
|
|
|
|
|
|
function func100
|
|
|
|
sleep 100 &
|
|
|
|
set -g tokill $tokill $last_pid
|
|
|
|
end
|
2020-01-01 05:12:24 +08:00
|
|
|
func100
|
Correct reordering of jobs in job_promote
job_promote attempts to bring the most recently "touched" job to the front
of the job list. It did this via:
std::rotate(begin, job, end)
However this has the effect of pushing job-1 to the end. That is,
promoting '2' in [1, 2, 3] would result in [2, 3, 1].
Correct this by replacing it with:
std::rotate(begin, job, job+1);
now we get the desired [2, 1, 3].
Also add a test.
2020-01-01 04:41:11 +08:00
|
|
|
|
2020-01-01 05:12:24 +08:00
|
|
|
# The redirection ensures this becomes a real job.
|
|
|
|
begin
|
Correct reordering of jobs in job_promote
job_promote attempts to bring the most recently "touched" job to the front
of the job list. It did this via:
std::rotate(begin, job, end)
However this has the effect of pushing job-1 to the end. That is,
promoting '2' in [1, 2, 3] would result in [2, 3, 1].
Correct this by replacing it with:
std::rotate(begin, job, job+1);
now we get the desired [2, 1, 3].
Also add a test.
2020-01-01 04:41:11 +08:00
|
|
|
sleep 200 &
|
|
|
|
set -g tokill $tokill $last_pid
|
2020-01-01 05:12:24 +08:00
|
|
|
end </dev/null
|
Correct reordering of jobs in job_promote
job_promote attempts to bring the most recently "touched" job to the front
of the job list. It did this via:
std::rotate(begin, job, end)
However this has the effect of pushing job-1 to the end. That is,
promoting '2' in [1, 2, 3] would result in [2, 3, 1].
Correct this by replacing it with:
std::rotate(begin, job, job+1);
now we get the desired [2, 1, 3].
Also add a test.
2020-01-01 04:41:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
sleep 300 &
|
|
|
|
set -g tokill $tokill $last_pid
|
|
|
|
|
|
|
|
jobs
|
|
|
|
|
2020-01-01 05:17:26 +08:00
|
|
|
#CHECK: Job Group{{.*}}
|
Correct reordering of jobs in job_promote
job_promote attempts to bring the most recently "touched" job to the front
of the job list. It did this via:
std::rotate(begin, job, end)
However this has the effect of pushing job-1 to the end. That is,
promoting '2' in [1, 2, 3] would result in [2, 3, 1].
Correct this by replacing it with:
std::rotate(begin, job, job+1);
now we get the desired [2, 1, 3].
Also add a test.
2020-01-01 04:41:11 +08:00
|
|
|
#CHECK: 3{{.*\t}}sleep 300 &
|
|
|
|
#CHECK: 2{{.*\t}}sleep 200 &
|
|
|
|
#CHECK: 1{{.*\t}}sleep 100 &
|
|
|
|
|
2020-01-17 07:59:10 +08:00
|
|
|
# Kill job 2; the next job should have job ID 4 because 3 is still in use (#6053).
|
|
|
|
|
|
|
|
status job-control interactive
|
|
|
|
command kill -9 $tokill[2]
|
2020-01-25 21:06:34 +08:00
|
|
|
# Wait for the job to die - the signal needs to be delivered.
|
|
|
|
wait $tokill[2] 2>/dev/null
|
2020-01-17 07:59:10 +08:00
|
|
|
set -e tokill[2]
|
|
|
|
status job-control full
|
|
|
|
sleep 400 &
|
|
|
|
set -g tokill $tokill $last_pid
|
|
|
|
|
|
|
|
jobs
|
|
|
|
|
|
|
|
#CHECK: Job Group{{.*}}
|
|
|
|
#CHECK: 4{{.*\t}}sleep 400 &
|
|
|
|
#CHECK: 3{{.*\t}}sleep 300 &
|
|
|
|
#CHECK: 1{{.*\t}}sleep 100 &
|
|
|
|
|
|
|
|
|
Correct reordering of jobs in job_promote
job_promote attempts to bring the most recently "touched" job to the front
of the job list. It did this via:
std::rotate(begin, job, end)
However this has the effect of pushing job-1 to the end. That is,
promoting '2' in [1, 2, 3] would result in [2, 3, 1].
Correct this by replacing it with:
std::rotate(begin, job, job+1);
now we get the desired [2, 1, 3].
Also add a test.
2020-01-01 04:41:11 +08:00
|
|
|
status job-control interactive
|
|
|
|
|
|
|
|
for pid in $tokill
|
|
|
|
command kill -9 $pid
|
|
|
|
end
|