mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-30 08:59:56 +02:00
commit bash-20040422 snapshot
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ job 6 returns 0
|
||||
Waiting for job 7
|
||||
job 7 returns 0
|
||||
0
|
||||
./jobs.tests: line 15: wait: no job control
|
||||
./jobs.tests: line 15: wait: %1: no such job
|
||||
./jobs.tests: line 20: fg: no job control
|
||||
wait-for-pid
|
||||
wait-errors
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
./jobs2.sub: line 9: fg: job 1 started without job control
|
||||
fg: 1
|
||||
Waiting for job 0
|
||||
job 0 returns 0
|
||||
Waiting for job 1
|
||||
job 1 returns 0
|
||||
Waiting for job 2
|
||||
job 2 returns 0
|
||||
Waiting for job 3
|
||||
job 3 returns 0
|
||||
Waiting for job 4
|
||||
job 4 returns 0
|
||||
Waiting for job 5
|
||||
job 5 returns 0
|
||||
Waiting for job 6
|
||||
job 6 returns 0
|
||||
Waiting for job 7
|
||||
job 7 returns 0
|
||||
0
|
||||
./jobs.tests: line 15: wait: no job control
|
||||
./jobs.tests: line 20: fg: no job control
|
||||
wait-for-pid
|
||||
wait-errors
|
||||
./jobs.tests: line 33: wait: `1-1': not a pid or valid job spec
|
||||
./jobs.tests: line 34: wait: `-4': not a pid or valid job spec
|
||||
wait-for-background-pids
|
||||
async list wait-for-background-pids
|
||||
async list wait for child
|
||||
forked
|
||||
wait-when-no-children
|
||||
wait-for-job
|
||||
./jobs.tests: line 56: wait: %2: no such job
|
||||
127
|
||||
async list wait-for-job
|
||||
forked
|
||||
fg-bg 1
|
||||
sleep 5
|
||||
fg-bg 2
|
||||
sleep 5
|
||||
fg-bg 3
|
||||
sleep 5
|
||||
fg-bg 4
|
||||
sleep 5
|
||||
fg-bg 5
|
||||
./jobs.tests: line 83: fg: %2: no such job
|
||||
./jobs.tests: line 84: bg: job 1 already in background
|
||||
fg-bg 6
|
||||
./jobs.tests: line 91: fg: -s: invalid option
|
||||
fg: usage: fg [job_spec]
|
||||
./jobs.tests: line 92: bg: -s: invalid option
|
||||
bg: usage: bg [job_spec]
|
||||
./jobs.tests: line 97: disown: -s: invalid option
|
||||
disown: usage: disown [-h] [-ar] [jobspec ...]
|
||||
./jobs.tests: line 101: disown: %1: no such job
|
||||
./jobs.tests: line 104: disown: %2: no such job
|
||||
wait-for-non-child
|
||||
./jobs.tests: line 107: wait: pid 1 is not a child of this shell
|
||||
127
|
||||
3 -- 1 2 3 -- 1 - 2 - 3
|
||||
[1] Running sleep 300 &
|
||||
[2]- Running sleep 350 &
|
||||
[3]+ Running sleep 400 &
|
||||
running jobs:
|
||||
[1] Running sleep 300 &
|
||||
[2]- Running sleep 350 &
|
||||
[3]+ Running sleep 400 &
|
||||
./jobs.tests: line 123: kill: %4: no such job
|
||||
./jobs.tests: line 125: jobs: %4: no such job
|
||||
current job:
|
||||
[3]+ Running sleep 400 &
|
||||
previous job:
|
||||
[2]- Running sleep 350 &
|
||||
after kill -STOP
|
||||
running jobs:
|
||||
[1] Running sleep 300 &
|
||||
[3]- Running sleep 400 &
|
||||
stopped jobs:
|
||||
[2]+ Stopped sleep 350
|
||||
after disown
|
||||
[2]+ Stopped sleep 350
|
||||
[3]- Running sleep 400 &
|
||||
running jobs:
|
||||
[3]- Running sleep 400 &
|
||||
stopped jobs:
|
||||
[2]+ Stopped sleep 350
|
||||
after kill -s CONT
|
||||
running jobs:
|
||||
[2]+ Running sleep 350 &
|
||||
[3]- Running sleep 400 &
|
||||
stopped jobs:
|
||||
after kill -STOP, backgrounding %3:
|
||||
[3]+ sleep 400 &
|
||||
killing...
|
||||
done
|
||||
after KILL -STOP, foregrounding %1
|
||||
sleep 10
|
||||
done
|
||||
+1
-1
@@ -11,7 +11,7 @@ ${THIS_SH} ./jobs3.sub
|
||||
jobs
|
||||
echo $?
|
||||
|
||||
# should be a job-control-not-enabled error
|
||||
# a no-such-job error, since we can use job control notation without job control
|
||||
wait %1
|
||||
|
||||
# make sure we can't fg a job started when job control was not active
|
||||
|
||||
@@ -0,0 +1,179 @@
|
||||
# test out %+, jobs -p, and $! agreement in a subshell first
|
||||
${THIS_SH} ./jobs1.sub
|
||||
|
||||
# test out fg/bg failure in a subshell
|
||||
${THIS_SH} ./jobs2.sub
|
||||
|
||||
# test out behavior of waiting for background pids -- bug in versions
|
||||
# before 2.03
|
||||
${THIS_SH} ./jobs3.sub
|
||||
|
||||
jobs
|
||||
echo $?
|
||||
|
||||
# should be a job-control-not-enabled error
|
||||
wait %1
|
||||
|
||||
# make sure we can't fg a job started when job control was not active
|
||||
sleep 30 &
|
||||
pid=$!
|
||||
fg %1
|
||||
# make sure the killed processes don't cause a message
|
||||
exec 5>&2
|
||||
exec 2>/dev/null
|
||||
kill -n 9 $pid
|
||||
wait # make sure we reap the processes while stderr is still redirected
|
||||
exec 2>&5
|
||||
|
||||
echo wait-for-pid
|
||||
sleep 10 &
|
||||
wait $!
|
||||
|
||||
echo wait-errors
|
||||
wait 1-1
|
||||
wait -- -4
|
||||
|
||||
echo wait-for-background-pids
|
||||
sleep 5 &
|
||||
sleep 8 &
|
||||
wait
|
||||
|
||||
echo async list wait-for-background-pids
|
||||
sleep 5 & sleep 8 &
|
||||
wait
|
||||
|
||||
echo async list wait for child
|
||||
sleep 5 & echo forked
|
||||
wait
|
||||
|
||||
echo wait-when-no-children
|
||||
wait
|
||||
|
||||
set -m
|
||||
|
||||
echo wait-for-job
|
||||
sleep 5 &
|
||||
wait %2 # this should be a no-such-job error
|
||||
echo $?
|
||||
wait %1
|
||||
|
||||
echo async list wait-for-job
|
||||
sleep 5 & echo forked
|
||||
wait %1
|
||||
|
||||
echo fg-bg 1
|
||||
sleep 5 &
|
||||
%1
|
||||
|
||||
echo fg-bg 2
|
||||
sleep 5 &
|
||||
fg %%
|
||||
|
||||
echo fg-bg 3
|
||||
sleep 5 &
|
||||
fg %s
|
||||
|
||||
echo fg-bg 4
|
||||
sleep 5 &
|
||||
fg %?ee
|
||||
|
||||
# these next two are error cases
|
||||
echo fg-bg 5
|
||||
sleep 15 &
|
||||
fg %2 # this should be a no-such-job error
|
||||
bg %1 # this should be a `bg background job?' error
|
||||
wait
|
||||
|
||||
# these may someday mean to start the jobs, but not print the line
|
||||
# describing the status, but for now they are errors
|
||||
echo fg-bg 6
|
||||
sleep 5 &
|
||||
fg -s %1
|
||||
bg -s %1
|
||||
wait
|
||||
|
||||
# someday this may mean to disown all stopped jobs, but for now it is
|
||||
# an error
|
||||
disown -s
|
||||
|
||||
# this is an error -- the job with the pid that is the value of $! is
|
||||
# retained only until a `wait' is performed
|
||||
disown %1
|
||||
|
||||
# this, however, is an error
|
||||
disown %2
|
||||
|
||||
echo wait-for-non-child
|
||||
wait 1
|
||||
echo $?
|
||||
|
||||
exit 1 | exit 2 | exit 3
|
||||
echo $? -- ${PIPESTATUS[@]} -- ${PIPESTATUS[0]} - ${PIPESTATUS[1]} - ${PIPESTATUS[2]}
|
||||
|
||||
sleep 300 &
|
||||
sleep 350 &
|
||||
sleep 400 &
|
||||
|
||||
jobs
|
||||
|
||||
echo running jobs:
|
||||
jobs -r
|
||||
|
||||
# should be an error
|
||||
kill -n 1 %4
|
||||
# should be an error
|
||||
jobs %4
|
||||
echo current job:
|
||||
jobs %+
|
||||
echo previous job:
|
||||
jobs %-
|
||||
|
||||
kill -STOP %2
|
||||
sleep 5 # give time for the shell to get the stop notification
|
||||
echo after kill -STOP
|
||||
echo running jobs:
|
||||
jobs -r
|
||||
echo stopped jobs:
|
||||
jobs -s
|
||||
|
||||
disown %1
|
||||
|
||||
echo after disown
|
||||
jobs
|
||||
echo running jobs:
|
||||
jobs -r
|
||||
echo stopped jobs:
|
||||
jobs -s
|
||||
|
||||
kill -s CONT %2
|
||||
echo after kill -s CONT
|
||||
echo running jobs:
|
||||
jobs -r
|
||||
echo stopped jobs:
|
||||
jobs -s
|
||||
|
||||
kill -STOP %3
|
||||
sleep 5 # give time for the shell to get the stop notification
|
||||
echo after kill -STOP, backgrounding %3:
|
||||
bg %3
|
||||
|
||||
disown -h %2
|
||||
|
||||
# make sure the killed processes don't cause a message
|
||||
exec 5>&2
|
||||
exec 2>/dev/null
|
||||
|
||||
echo killing...
|
||||
kill -n 9 %2 %3
|
||||
wait # make sure we reap the processes while stderr is still redirected
|
||||
echo done
|
||||
|
||||
exec 2>&5
|
||||
|
||||
sleep 10 &
|
||||
kill -STOP %1
|
||||
sleep 5 # give time for the shell to get the stop notification
|
||||
echo after KILL -STOP, foregrounding %1
|
||||
fg %1
|
||||
|
||||
echo done
|
||||
Reference in New Issue
Block a user