Make URL override smarter (thx Adam)

to not crash local PlayWright tests that here might get
Electron command-line options.

See https://github.com/nativefier/nativefier/pull/1437#issuecomment-1193315259
This commit is contained in:
Ronan Jouchet 2022-07-24 10:33:31 -04:00
parent e12da46064
commit a4ef7481de
1 changed files with 4 additions and 2 deletions

View File

@ -85,9 +85,11 @@ if (isWindows()) {
app.setAppUserModelId(app.getName());
}
const urlArgv = process.argv.filter((a) => a.startsWith('http'));
// Take in a URL on the command line as an override
if (process.argv.length > 1) {
const maybeUrl = process.argv[1];
if (urlArgv.length > 0) {
const maybeUrl = urlArgv[0];
try {
new URL(maybeUrl);
appArgs.targetUrl = maybeUrl;