1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

tests/jobs.sh: suppress error msg on noncompliant 'ps'

This commit is contained in:
Martijn Dekker 2021-02-12 23:52:25 +00:00
parent dec10fee6a
commit 8c1e9971a7

View file

@ -20,7 +20,7 @@ function err_exit
let Errors++ let Errors++
} }
alias err_exit='err_exit $LINENO' alias err_exit='err_exit $LINENO'
alias warning='err\_exit $((Errors--,LINENO))' alias warning='err\_exit $((Errors--,LINENO)) warning:'
Command=${0##*/} Command=${0##*/}
integer Errors=0 integer Errors=0
@ -79,7 +79,7 @@ kill %+ >out 2>&1 || err_exit "'kill %+' not working in script (got $(printf %q
# ===== # =====
# Before 2021-02-11, job control was deactivated in subshells # Before 2021-02-11, job control was deactivated in subshells
# https://www.mail-archive.com/austin-group-l@opengroup.org/msg06456.html # https://www.mail-archive.com/austin-group-l@opengroup.org/msg06456.html
(sleep 1 & UNIX95=1 ps -o pid=,pgid= -p $!) | IFS=$' \t' read -r pid pgid (sleep 1 & UNIX95=1 command -p ps -o pid=,pgid= -p $! 2>/dev/null) | IFS=$' \t' read -r pid pgid
if let "pid>0 && pgid>0" 2>/dev/null if let "pid>0 && pgid>0" 2>/dev/null
then kill $pid then kill $pid
let "pgid == pid" || err_exit "background job run in subshell didn't get its own process group ($pgid != $pid)" let "pgid == pid" || err_exit "background job run in subshell didn't get its own process group ($pgid != $pid)"