Skip to content

Commit

Permalink
Respect logging CLI arguments
Browse files Browse the repository at this point in the history
On Windows, logging module is initialized after sandbox creation.
But NW package is initialized ealier that that, which causes the
creation of `debug.log` no matter if `--enable-logging` or
`--disable-logging` is set. The patch moved the initialization of
NW package after logging is initialized.

The limitation is that logging CLI argument can't be passed by
`chromium-args` in nw package, because nw package is initialized
after the logging initialization.

Fixed nwjs/nw.js#4637
  • Loading branch information
Cong Liu committed Mar 29, 2016
1 parent be93622 commit 172c644
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions chrome/app/chrome_main_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -740,8 +740,11 @@ void ChromeMainDelegate::PreSandboxStartup() {
crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer());
#endif

#if defined(OS_MACOSX)
if (process_type.empty())
nw::InitNWPackage();
#endif

#if defined(OS_MACOSX)
// On the Mac, the child executable lives at a predefined location within
// the app bundle's versioned directory.
Expand Down Expand Up @@ -909,6 +912,14 @@ void ChromeMainDelegate::SandboxInitialized(const std::string& process_type) {
chrome_pdf::PPP_ShutdownModule);
#endif
#endif

#if !define(OS_MACOSX)
// Make sure nw package is initialized after logging initialization.
// On Windows, the logging is initialized after sanbox is created.
// See https://github.com/nwjs/nw.js/issues/4637
if (process_type.empty())
nw::InitNWPackage();
#endif
}

int ChromeMainDelegate::RunProcess(
Expand Down

0 comments on commit 172c644

Please sign in to comment.