Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GOOGLE_CHROME_SHIM now responds to --version and --product-version. #73

Merged
merged 1 commit into from
Jun 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,13 @@ BIN_DIR=$BUILD_DIR/.apt/usr/bin
rm $BIN_DIR/$SHIM
cat <<EOF >$BIN_DIR/$SHIM
#!/usr/bin/env bash
exec \$HOME/.apt/opt/google/$BIN --headless --no-sandbox --disable-gpu --remote-debugging-port=9222 \$@
if [ $1 = "--version" ]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the $ in $1 be escaped ?
When using the heroku/google-chrome buildpack and running heroku ci:debug, I get

~ $ cat $GOOGLE_CHROME_SHIM   
#!/usr/bin/env bash
if [ /app = "--version" ]; then
  exec $HOME/.apt/opt/google/chrome/chrome --version
elif [ /app = "--product-version" ]; then
  exec $HOME/.apt/opt/google/chrome/chrome --product-version
else
  exec $HOME/.apt/opt/google/chrome/chrome --headless --no-sandbox --disable-gpu --remote-debugging-port=9222 $@
fi
~ $ 

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is correct, I'm seeing this:

if [ /tmp/build_9b8b699572a1f61d9096ed0e275f2c41 = "--version" ]; then

because the $1 isn't escaped.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #74

exec \$HOME/.apt/opt/google/$BIN --version
elif [ $1 = "--product-version" ]; then
exec \$HOME/.apt/opt/google/$BIN --product-version
else
exec \$HOME/.apt/opt/google/$BIN --headless --no-sandbox --disable-gpu --remote-debugging-port=9222 \$@
fi
EOF
chmod +x $BIN_DIR/$SHIM
cp $BIN_DIR/$SHIM $BIN_DIR/google-chrome
Expand Down