Skip to content

Instantly share code, notes, and snippets.

@ervinb
Last active July 20, 2017 14:09
Show Gist options
  • Select an option

  • Save ervinb/54e500a3457a659264f891fe197cb66f to your computer and use it in GitHub Desktop.

Select an option

Save ervinb/54e500a3457a659264f891fe197cb66f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
chrome_aliases=('/usr/bin/google-chrome' '/usr/bin/google-chrome-stable')
wrapper_name="chrome-wrapper"
wrapper_install_path="/opt/$wrapper_name"
cat <<WRP > $wrapper_install_path
#!/bin/bash
_kill_proc() {
kill -TERM \$chrome
}
trap _kill_proc SIGTERM
/opt/google/chrome/google-chrome \$@ &
chrome=\$!
wait \$chrome
wait \$chrome
WRP
for alias in ${chrome_aliases[@]}; do
ln -fs $wrapper_install_path $alias
chmod +x $alias
done
@ervinb

ervinb commented Jul 20, 2017

Copy link
Copy Markdown
Author

Solution for when Karma or some other test runner can't properly shutdown Chrome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment