clipmenud: Fix killing background jobs when there are multiple
`jobs -p' should be read into an array, as it might contain more than one job. [cdown: squash, massage changelog, remove space between local/readarray]
This commit is contained in:
parent
775adccfb4
commit
bc35b6f44a
|
@ -88,12 +88,12 @@ kill_background_jobs() {
|
||||||
# While we usually _are_, there are no guarantees that we're the process
|
# While we usually _are_, there are no guarantees that we're the process
|
||||||
# group leader. As such, all we can do is look at the pending jobs. Bash
|
# group leader. As such, all we can do is look at the pending jobs. Bash
|
||||||
# avoids a subshell here, so the job list is in the right shell.
|
# avoids a subshell here, so the job list is in the right shell.
|
||||||
local bg
|
local -a bg
|
||||||
bg=$(jobs -p)
|
readarray -t bg < <(jobs -p)
|
||||||
|
|
||||||
# Don't log `kill' failures, since with KillMode=control-group, we're
|
# Don't log `kill' failures, since with KillMode=control-group, we're
|
||||||
# racing with init.
|
# racing with init.
|
||||||
[[ $bg ]] && kill -- "$bg" 2>/dev/null
|
(( ${#bg[@]} )) && kill -- "${bg[@]}" 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $1 == --help ]] || [[ $1 == -h ]]; then
|
if [[ $1 == --help ]] || [[ $1 == -h ]]; then
|
||||||
|
|
Loading…
Reference in a new issue