Compare commits

...

2 Commits

Author SHA1 Message Date
dd6f24551d 1.0.9 2019-11-15 23:59:35 +01:00
f4d0e9ad87 fix(core): update 2019-11-15 23:59:34 +01:00
3 changed files with 14 additions and 5 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartpuppeteer", "name": "@pushrocks/smartpuppeteer",
"version": "1.0.8", "version": "1.0.9",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartpuppeteer", "name": "@pushrocks/smartpuppeteer",
"version": "1.0.8", "version": "1.0.9",
"private": false, "private": false,
"description": "simplified access to puppeteer", "description": "simplified access to puppeteer",
"main": "dist/index.js", "main": "dist/index.js",

View File

@@ -19,21 +19,30 @@ export const getEnvAwareBrowserInstance = async (
if ((process.env.CI || options.forceNoSandbox) && !smartenv.isWsl) { if ((process.env.CI || options.forceNoSandbox) && !smartenv.isWsl) {
chromeArgs = chromeArgs.concat([ chromeArgs = chromeArgs.concat([
'--no-sandbox', '--no-sandbox',
'--disable-setuid-sandbox' '--disable-setuid-sandbox',
// '--disable-dev-shm-usage' '--disable-dev-shm-usage'
]); ]);
} }
let headlessBrowser: plugins.puppeteer.Browser; let headlessBrowser: plugins.puppeteer.Browser;
if (!smartenv.isWsl) { if (!smartenv.isWsl) {
// lets get the actual instance // lets get the actual instance
console.log('launching puppeteer bundled chrome');
headlessBrowser = await plugins.puppeteer.launch({ headlessBrowser = await plugins.puppeteer.launch({
args: chromeArgs args: chromeArgs
}); });
} else { } else {
console.log('Detected WSL. Using chromium.'); console.log('Detected WSL. Using chromium.');
headlessBrowser = await plugins.puppeteer.launch({ headlessBrowser = await plugins.puppeteer.launch({
executablePath: '/usr/bin/chromium-browser' args: [
'--disable-gpu',
'--disable-dev-shm-usage',
'--disable-setuid-sandbox',
'--no-first-run',
'--no-sandbox',
'--no-zygote',
'--single-process'
]
}); });
} }