chore: run w/ sandbox by default (#412)

This commit is contained in:
Pavel Feldman 2025-05-13 15:30:02 -07:00 committed by GitHub
parent 7be0c8872e
commit c506027aec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 7 deletions

View file

@ -39,6 +39,7 @@ export type CLIOptions = {
ignoreHttpsErrors?: boolean;
isolated?: boolean;
noImageResponses?: boolean;
sandbox?: boolean;
outputDir?: string;
port?: number;
proxyBypass?: string;
@ -56,6 +57,7 @@ const defaultConfig: Config = {
launchOptions: {
channel: 'chrome',
headless: os.platform() === 'linux' && !process.env.DISPLAY,
chromiumSandbox: true,
},
contextOptions: {
viewport: null,
@ -107,8 +109,11 @@ export async function configFromCLIOptions(cliOptions: CLIOptions): Promise<Conf
headless: cliOptions.headless,
};
if (browserName === 'chromium')
if (browserName === 'chromium') {
(launchOptions as any).cdpPort = await findFreePort();
if (cliOptions.sandbox === false)
launchOptions.chromiumSandbox = false;
}
if (cliOptions.proxyServer) {
launchOptions.proxy = {