Skip to content

Commit

Permalink
Improve CLI parsing
Browse files Browse the repository at this point in the history
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:
- microsoft/playwright#23385
- microsoft/playwright#16614
  • Loading branch information
c3er committed Dec 3, 2023
1 parent a88485f commit 6d3bf3b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/main.js
Expand Up @@ -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

Expand Down

0 comments on commit 6d3bf3b

Please sign in to comment.