Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 2/6] virtualx.eclass: Pass xvfbargs as an array
Date: Wed, 27 Jul 2022 07:18:10
Message-Id: 20220727071722.277530-3-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/6] virtualx.eclass: Use Xvfb -displayfd ... + cleanup by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/virtualx.eclass | 14 +++++++-------
4 1 file changed, 7 insertions(+), 7 deletions(-)
5
6 diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass
7 index 5c4b39164cff..d7b82e12cdd5 100644
8 --- a/eclass/virtualx.eclass
9 +++ b/eclass/virtualx.eclass
10 @@ -109,7 +109,7 @@ virtx() {
11 local retval=0
12 local OLD_SANDBOX_ON="${SANDBOX_ON}"
13 local XVFB XHOST XDISPLAY
14 - local xvfbargs="-screen 0 1280x1024x24 +extension RANDR"
15 + local xvfbargs=( -screen 0 1280x1024x24 +extension RANDR )
16 XVFB=$(type -p Xvfb) || die
17 XHOST=$(type -p xhost) || die
18
19 @@ -134,24 +134,24 @@ virtx() {
20 # We really do not want SANDBOX enabled here
21 export SANDBOX_ON="0"
22
23 - debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs}"
24 - ${XVFB} :${XDISPLAY} ${xvfbargs} &>/dev/null &
25 + debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs[*]}"
26 + ${XVFB} :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null &
27 sleep 2
28
29 local start=${XDISPLAY}
30 while [[ ! -f /tmp/.X${XDISPLAY}-lock ]]; do
31 # Stop trying after 15 tries
32 if ((XDISPLAY - start > 15)) ; then
33 - eerror "'${XVFB} :${XDISPLAY} ${xvfbargs}' returns:"
34 + eerror "'${XVFB} :${XDISPLAY} ${xvfbargs[*]}' returns:"
35 echo
36 - ${XVFB} :${XDISPLAY} ${xvfbargs}
37 + ${XVFB} :${XDISPLAY} "${xvfbargs[@]}"
38 echo
39 eerror "If possible, correct the above error and try your emerge again."
40 die "Unable to start Xvfb"
41 fi
42 ((XDISPLAY++))
43 - debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs}"
44 - ${XVFB} :${XDISPLAY} ${xvfbargs} &>/dev/null &
45 + debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs[*]}"
46 + ${XVFB} :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null &
47 sleep 2
48 done
49
50 --
51 2.35.1