From 6d3bf3bb8650893f9976e8fc6c5bd23a6a8f0819 Mon Sep 17 00:00:00 2001 From: Christian Dreier Date: Sun, 3 Dec 2023 21:53:20 +0100 Subject: [PATCH] Improve CLI parsing The "hideBin" function of the Yargs library fails on the additional arguments that by Playwright *in between* the Electron executable and the working directory containing the actual application. See Playwright issues: - https://github.com/microsoft/playwright/issues/23385 - https://github.com/microsoft/playwright/issues/16614 --- app/main.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/main.js b/app/main.js index ebc55d2..f0581e7 100644 --- a/app/main.js +++ b/app/main.js @@ -69,7 +69,16 @@ function handleConsoleError(err) { electron.app.whenReady().then(async () => { cli.init() - const cliArgs = cli.parse(cli.hideBin(process.argv)) + const args = process.argv + log.debug("Unfiltered CLI arguments:", args) + const cliArgs = cli.parse( + cli.hideBin( + args.filter( + arg => !arg.includes("--remote-debugging-port") && !arg.includes("--inspect"), + ), + ), + ) + await log.init(cliArgs.logDir) const filePath = cliArgs.filePath