Skip to content

Commit

Permalink
[1.11] Autodetect Chromium too (#597)
Browse files Browse the repository at this point in the history
* autodetect Chromium

Previosly only google-chrome was detected, that's a nuisance for people who have Chromium installed but not Google Chrome.

* StyleCI
  • Loading branch information
divinity76 authored Mar 17, 2024
1 parent c1d78d3 commit 8288867
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/AutoDiscover.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function guessChromeBinaryPath(): string
case 'Windows':
return self::getFromRegistry() ?? '%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe';
default:
return null === self::shellExec('command -v google-chrome') ? 'chrome' : 'google-chrome';
return \rtrim(\explode("\n", (string) self::shellExec('command -v google-chrome chromium-browser chrome chromium'), 2)[0]) ?: 'chrome';
}
}

Expand Down
4 changes: 3 additions & 1 deletion tests/AutoDiscoverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ public function testLinux(): void
$autoDiscover->guessChromeBinaryPath(),
$this->logicalOr(
'chrome',
'google-chrome'
'/usr/bin/google-chrome',
'/usr/bin/chromium-browser',
'/snap/bin/chromium'
)
);
}
Expand Down

0 comments on commit 8288867

Please sign in to comment.