mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00: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');
|
controller.setLogName('browser');
|
||||||
return controller.run(async progress => {
|
return controller.run(async progress => {
|
||||||
let app: ElectronApplication | undefined = undefined;
|
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];
|
const electronArguments = ['--inspect=0', '--remote-debugging-port=0', ...args];
|
||||||
|
|
||||||
if (os.platform() === 'linux') {
|
if (os.platform() === 'linux') {
|
||||||
const runningAsRoot = process.geteuid && process.geteuid() === 0;
|
const runningAsRoot = process.geteuid && process.geteuid() === 0;
|
||||||
if (runningAsRoot && electronArguments.indexOf('--no-sandbox') === -1)
|
if (runningAsRoot && electronArguments.indexOf('--no-sandbox') === -1)
|
||||||
electronArguments.push('--no-sandbox');
|
electronArguments.unshift('--no-sandbox');
|
||||||
}
|
}
|
||||||
|
|
||||||
const artifactsDir = await fs.promises.mkdtemp(ARTIFACTS_FOLDER);
|
const artifactsDir = await fs.promises.mkdtemp(ARTIFACTS_FOLDER);
|
||||||
|
@ -17,9 +17,10 @@
|
|||||||
const { app } = require('electron');
|
const { app } = require('electron');
|
||||||
const { chromiumSwitches } = require('../chromium/chromiumSwitches');
|
const { chromiumSwitches } = require('../chromium/chromiumSwitches');
|
||||||
|
|
||||||
// [Electron, -r, loader.js, --inspect=0, --remote-debugging-port=0, ...args]
|
// Always pass user arguments first, see https://github.com/microsoft/playwright/issues/16614 and
|
||||||
process.argv.splice(1, 4);
|
// 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) {
|
for (const arg of chromiumSwitches) {
|
||||||
const match = arg.match(/--([^=]*)=?(.*)/)!;
|
const match = arg.match(/--([^=]*)=?(.*)/)!;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user