Skip to content

Commit

Permalink
fix gwuhaolin#2: support Alpine linux by retrying grep with "-r" in c…
Browse files Browse the repository at this point in the history
…ase an exception is thrown.
  • Loading branch information
nros committed Sep 14, 2017
1 parent 99b0578 commit 0afd72e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ function findChromeExecutablesForLinuxDesktop(folder) {
// Output of the grep & print looks like:
// /opt/google/chrome/google-chrome --profile-directory
// /home/user/Downloads/chrome-linux/chrome-wrapper %U
let execPaths = execSync(`grep -ER "${chromeExecRegex}" ${folder} | awk -F '=' '{print $2}'`)
let execPaths;
try {
execPaths = execSync(`grep -ER "${chromeExecRegex}" ${folder} | awk -F '=' '{print $2}'`);
} catch (e) {
// for Alpine linux, brutally retry without "-R".
execPaths = execSync(`grep -Er "${chromeExecRegex}" ${folder} | awk -F '=' '{print $2}'`);
}

execPaths = execPaths
.toString()
.split(newLineRegex)
.map((execPath) => execPath.replace(argumentsRegex, '$1'));
Expand Down

0 comments on commit 0afd72e

Please sign in to comment.