豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 2a8276e

Browse files
authored
feat: support PUPPETEER_DANGEROUS_NO_SANDBOX environment variable (#14756)
1 parent 14685a0 commit 2a8276e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/puppeteer-core/src/node/ChromeLauncher.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,14 @@ export class ChromeLauncher extends BrowserLauncher {
245245
userDataDir,
246246
enableExtensions = false,
247247
} = options;
248+
249+
if (
250+
process.env['PUPPETEER_DANGEROUS_NO_SANDBOX'] === 'true' &&
251+
!args.includes('--no-sandbox')
252+
) {
253+
chromeArguments.push('--no-sandbox');
254+
}
255+
248256
if (userDataDir) {
249257
// If absolute (for any platform) path is given, we should not resolve it.
250258
chromeArguments.push(

0 commit comments

Comments
 (0)