Skip to content

Commit

Permalink
fix: Don't swallow console.log messages until after CLI arguments are…
Browse files Browse the repository at this point in the history
… parsed

yargs depends on an intact console.log to display help and usage messages,
so just delay the override by a few statements.
  • Loading branch information
claytonrcarter committed May 4, 2022
1 parent 80b6c8a commit 0ae715d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main-process/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ module.exports = function start(resourcePath, devResourcePath, startTime) {
}
});

const previousConsoleLog = console.log;
console.log = nslog;

// TodoElectronIssue this should be set to true before Electron 12 - https://github.com/electron/electron/issues/18397
app.allowRendererProcessReuse = false;

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

const args = parseCommandLine(process.argv.slice(1));

// This must happen after parseCommandLine() because yargs uses console.log
// to display the usage message.
const previousConsoleLog = console.log;
console.log = nslog;

args.resourcePath = normalizeDriveLetterName(resourcePath);
args.devResourcePath = normalizeDriveLetterName(devResourcePath);

Expand Down

0 comments on commit 0ae715d

Please sign in to comment.