-
Notifications
You must be signed in to change notification settings - Fork 278
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
fix guessChromeBinaryPath on Ubuntu Linux + add Chromium #595
Conversation
on Ubutu Linux, "command" is a bash builtin, not a standalone binary, and shell_exec() tries to find the "command" binary and fails, thus the original code never worked on Ubuntu Linux (I think the same is true for the entire Debian-derived family of operating systems, but don't quote me on that), fixing that by doing `bash -c 'command...` instead. Also added chromium support, for those who have Chromium but not Chrome installed. It will look for Chrome first, and if it cannot find Chrome, it will look for Chromium second, and if all fails, it falls back to hardcoded "chrome".
there is also a FOSS game by the name chromium iirc..
I use Ubuntu and it works fine here 🤔
|
yeah in your shell with your shell builtins, but try php -r 'var_dump(shell_exec("command -v google-chrome"));' and then try php -r 'var_dump(shell_exec("bash -c '\''command -v google-chrome'\''"));' |
Same thing in both: λ php -r 'var_dump(shell_exec("command -v google-chrome"));'
string(23) "/usr/bin/google-chrome
" λ php -r 'var_dump(shell_exec("bash -c '\''command -v google-chrome'\''"));'
string(23) "/usr/bin/google-chrome
" |
@enricodias well that confuses me, what do you get by
? When I do it, I get
|
I got the same; command is a shell builtin
NULL It is a builtin, but |
@enricodias wow.. you're entirely correct! I could've sworn that |
on Ubutu Linux, "command" is a bash builtin, not a standalone binary, and shell_exec() tries to find the "command" binary and fails, thus the original code never worked on Ubuntu Linux (I think the same is true for the entire Debian-derived family of operating systems, but don't quote me on that), fixing that by doing
bash -c 'command...
instead.Also added chromium support, for those who have Chromium but not Chrome installed.
It will look for Chrome first, and if it cannot find Chrome, it will look for Chromium second, and if all fails, it falls back to hardcoded "chrome".