Skip to content

Commit

Permalink
webui: Store browser in array
Browse files Browse the repository at this point in the history
At the moment most of the firefox command line is getting placed
in a variable named $BROWSER and then getting run as

$BROWSER http://url

This only works if $BROWSER is at the very front of the line or if
it's run through eval.

Instead, make BROWSER into an array so it's positional arguments
get expanded positionally.
  • Loading branch information
halfline committed Aug 31, 2023
1 parent 7e85f3f commit 1c6b6c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ui/webui/webui-desktop
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ THEME_PATH="${FIREFOX_THEME_DIR}/${THEME_ID}"
cp -a "${THEME_PATH}/." ${FIREFOX_PROFILE_PATH}

# FIXME: is this hardcoded resolution necessary ?
BROWSER="/usr/bin/firefox --new-instance --window-size 1024,768 --profile ${FIREFOX_PROFILE_PATH}"
BROWSER=(/usr/bin/firefox --new-instance --window-size "1024,768" --profile "${FIREFOX_PROFILE_PATH}")

# start browser in a temporary home dir, so that it does not interfere with your real one
BROWSER_HOME=$(mktemp --directory --tmpdir cockpit.desktop.XXXXXX)
Expand Down Expand Up @@ -126,7 +126,7 @@ fi
# XDG_RUNTIME_DIR so it is willing to start.
unset XAUTHORITY XDG_RUNTIME_DIR

HOME="$BROWSER_HOME" $BROWSER http://"$WEBUI_ADDRESS""$URL_PATH" &
HOME="$BROWSER_HOME" "${BROWSER[@]}" http://"$WEBUI_ADDRESS""$URL_PATH" &
B_PID=$!

wait $B_PID

0 comments on commit 1c6b6c0

Please sign in to comment.