@@ -29,6 +29,7 @@ import {ChromeMode} from '../options/chrome-mode';
2929import type { DownloadBrowserProgressFn } from '../options/on-browser-download' ;
3030import {
3131 getChromeDownloadUrl ,
32+ isAmazonLinux2023 ,
3233 logDownloadUrl ,
3334 type Platform ,
3435 TESTED_VERSION ,
@@ -183,22 +184,33 @@ export const downloadBrowser = async ({
183184 abortSignal : new AbortController ( ) . signal ,
184185 } ) ;
185186 await extractZip ( archivePath , { dir : outputPath } ) ;
186- const chromePath = path . join ( outputPath , 'chrome-linux' , 'chrome' ) ;
187- const chromeHeadlessShellPath = path . join (
188- outputPath ,
189- 'chrome-linux' ,
190- 'chrome-headless-shell' ,
191- ) ;
192- if ( fs . existsSync ( chromePath ) ) {
193- fs . renameSync ( chromePath , chromeHeadlessShellPath ) ;
194- }
195187
196- const chromeLinuxFolder = path . join ( outputPath , 'chrome-linux' ) ;
197- if ( fs . existsSync ( chromeLinuxFolder ) ) {
198- fs . renameSync (
199- chromeLinuxFolder ,
200- path . join ( outputPath , 'chrome-headless-shell-linux-arm64' ) ,
201- ) ;
188+ const possibleSubdirs = [
189+ 'chrome-linux' ,
190+ 'chrome-headless-shell-linux64' ,
191+ 'chromium-headless-shell-amazon-linux2023-arm64' ,
192+ 'chromium-headless-shell-amazon-linux2023-x64' ,
193+ ] ;
194+
195+ for ( const subdir of possibleSubdirs ) {
196+ const chromeLinuxFolder = path . join ( outputPath , subdir ) ;
197+ const chromePath = path . join ( chromeLinuxFolder , 'chrome' ) ;
198+
199+ if ( fs . existsSync ( chromePath ) ) {
200+ const chromeHeadlessShellPath = path . join (
201+ chromeLinuxFolder ,
202+ 'chrome-headless-shell' ,
203+ ) ;
204+
205+ fs . renameSync ( chromePath , chromeHeadlessShellPath ) ;
206+ }
207+
208+ if ( fs . existsSync ( chromeLinuxFolder ) ) {
209+ fs . renameSync (
210+ chromeLinuxFolder ,
211+ path . join ( outputPath , 'chrome-headless-shell-' + platform ) ,
212+ ) ;
213+ }
202214 }
203215 } catch ( err ) {
204216 return Promise . reject ( err ) ;
@@ -248,7 +260,7 @@ const getExecutablePath = (chromeMode: ChromeMode) => {
248260 `chrome-headless-shell-${ platform } ` ,
249261 platform === 'win64'
250262 ? 'chrome-headless-shell.exe'
251- : platform === 'linux-arm64'
263+ : platform === 'linux-arm64' || isAmazonLinux2023 ( )
252264 ? 'headless_shell'
253265 : 'chrome-headless-shell' ,
254266 ) ;
0 commit comments