Skip to content

Commit

Permalink
Merge pull request #44 from Fgerthoffert/develop
Browse files Browse the repository at this point in the history
Added a flag to detect root and run with no-sandbox
  • Loading branch information
Fgerthoffert authored Aug 12, 2020
2 parents 0fe2854 + 8a0e448 commit dcf7ee8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/utils/puppeteer/launch/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import * as puppeteer from 'puppeteer';

const launchPuppeteer = async (headless: boolean) => {
const launchArgs = [
'--disable-dev-shm-usage',
'--start-maximized',
// '--start-fullscreen',
// '--disable-setuid-sandbox',
];
if (process.getuid() === 0) {
launchArgs.push('--no-sandbox');
}
const browser = await puppeteer.launch({
headless: headless,
defaultViewport: null,
args: [
'--disable-dev-shm-usage',
'--start-maximized',
// '--start-fullscreen',
// '--no-sandbox',
// '--disable-setuid-sandbox',
],
args: launchArgs,
});
return browser;
};
Expand Down

0 comments on commit dcf7ee8

Please sign in to comment.