mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
fix(electron): make sure user arguments go first (#29204)
This commit is contained in:
parent
82f40d0802
commit
ad6e40538a
@ -135,12 +135,13 @@ export class Electron extends SdkObject {
|
||||
controller.setLogName('browser');
|
||||
return controller.run(async progress => {
|
||||
let app: ElectronApplication | undefined = undefined;
|
||||
// --remote-debugging-port=0 must be the last playwright's argument, loader.ts relies on it.
|
||||
const electronArguments = ['--inspect=0', '--remote-debugging-port=0', ...args];
|
||||
|
||||
if (os.platform() === 'linux') {
|
||||
const runningAsRoot = process.geteuid && process.geteuid() === 0;
|
||||
if (runningAsRoot && electronArguments.indexOf('--no-sandbox') === -1)
|
||||
electronArguments.push('--no-sandbox');
|
||||
electronArguments.unshift('--no-sandbox');
|
||||
}
|
||||
|
||||
const artifactsDir = await fs.promises.mkdtemp(ARTIFACTS_FOLDER);
|
||||
|
@ -17,9 +17,10 @@
|
||||
const { app } = require('electron');
|
||||
const { chromiumSwitches } = require('../chromium/chromiumSwitches');
|
||||
|
||||
// [Electron, -r, loader.js, --inspect=0, --remote-debugging-port=0, ...args]
|
||||
process.argv.splice(1, 4);
|
||||
|
||||
// Always pass user arguments first, see https://github.com/microsoft/playwright/issues/16614 and
|
||||
// https://github.com/microsoft/playwright/issues/29198.
|
||||
// [Electron, -r, loader.js[, --no-sandbox>], --inspect=0, --remote-debugging-port=0, ...args]
|
||||
process.argv.splice(1, process.argv.indexOf('--remote-debugging-port=0'));
|
||||
|
||||
for (const arg of chromiumSwitches) {
|
||||
const match = arg.match(/--([^=]*)=?(.*)/)!;
|
||||
|
Loading…
Reference in New Issue
Block a user