commit:     aa75351b53dbd55153b224bc97ea1fec141dc7c6
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  8 06:26:50 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Aug  2 04:03:39 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa75351b

virtualx.eclass: Pass xvfbargs as an array

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/virtualx.eclass | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/eclass/virtualx.eclass b/eclass/virtualx.eclass
index 5c4b39164cff..d7b82e12cdd5 100644
--- a/eclass/virtualx.eclass
+++ b/eclass/virtualx.eclass
@@ -109,7 +109,7 @@ virtx() {
        local retval=0
        local OLD_SANDBOX_ON="${SANDBOX_ON}"
        local XVFB XHOST XDISPLAY
-       local xvfbargs="-screen 0 1280x1024x24 +extension RANDR"
+       local xvfbargs=( -screen 0 1280x1024x24 +extension RANDR )
        XVFB=$(type -p Xvfb) || die
        XHOST=$(type -p xhost) || die
 
@@ -134,24 +134,24 @@ virtx() {
        # We really do not want SANDBOX enabled here
        export SANDBOX_ON="0"
 
-       debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs}"
-       ${XVFB} :${XDISPLAY} ${xvfbargs} &>/dev/null &
+       debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs[*]}"
+       ${XVFB} :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null &
        sleep 2
 
        local start=${XDISPLAY}
        while [[ ! -f /tmp/.X${XDISPLAY}-lock ]]; do
                # Stop trying after 15 tries
                if ((XDISPLAY - start > 15)) ; then
-                       eerror "'${XVFB} :${XDISPLAY} ${xvfbargs}' returns:"
+                       eerror "'${XVFB} :${XDISPLAY} ${xvfbargs[*]}' returns:"
                        echo
-                       ${XVFB} :${XDISPLAY} ${xvfbargs}
+                       ${XVFB} :${XDISPLAY} "${xvfbargs[@]}"
                        echo
                        eerror "If possible, correct the above error and try 
your emerge again."
                        die "Unable to start Xvfb"
                fi
                        ((XDISPLAY++))
-               debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs}"
-               ${XVFB} :${XDISPLAY} ${xvfbargs} &>/dev/null &
+               debug-print "${FUNCNAME}: ${XVFB} :${XDISPLAY} ${xvfbargs[*]}"
+               ${XVFB} :${XDISPLAY} "${xvfbargs[@]}" &>/dev/null &
                sleep 2
        done
 

Reply via email to