Skip to content

Commit 0ae715d

Browse files
fix: Don't swallow console.log messages until after CLI arguments are parsed
yargs depends on an intact console.log to display help and usage messages, so just delay the override by a few statements.
1 parent 80b6c8a commit 0ae715d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main-process/start.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,18 @@ module.exports = function start(resourcePath, devResourcePath, startTime) {
3737
}
3838
});
3939

40-
const previousConsoleLog = console.log;
41-
console.log = nslog;
42-
4340
// TodoElectronIssue this should be set to true before Electron 12 - https://github.com/electron/electron/issues/18397
4441
app.allowRendererProcessReuse = false;
4542

4643
app.commandLine.appendSwitch('enable-experimental-web-platform-features');
4744

4845
const args = parseCommandLine(process.argv.slice(1));
46+
47+
// This must happen after parseCommandLine() because yargs uses console.log
48+
// to display the usage message.
49+
const previousConsoleLog = console.log;
50+
console.log = nslog;
51+
4952
args.resourcePath = normalizeDriveLetterName(resourcePath);
5053
args.devResourcePath = normalizeDriveLetterName(devResourcePath);
5154

0 commit comments

Comments
 (0)