Nw.js: Chromium command-line logging flags behave differently when specified in package.json

Created on 30 Jan 2017  路  10Comments  路  Source: nwjs/nw.js

NW.js version 0.16.1
Windows 10
Software written on Mac OS 10.12.2

I am experiencing different behaviour when using Chromium's --enable-logging flag as part of a NW.js application. On a Windows 10 machine, specifying the logging flag as part of the package.json "chromium-args": "--enable-logging --v=1" spawns two extra prompt windows in addition to the main window. This behaviour does not occur on Windows 7.

Searching the Chromium documentation suggested adding the --no-sandbox flag would solve this issue. Adding it to the package.json file did not change the behaviour.

However, providing the logging flag through the command line and not in the package.json file yields the desired result.

"App Name.exe" --enable-logging --v=1
The log file is generated as expected and no extra windows are spawned on launch. Why is there a difference when I specify the argument on the command line vs. in the chromium-args section of the package.json file? And secondly, how can I get the desired behaviour by specifying everything in the package?

Same question posted on SO: http://stackoverflow.com/questions/41880316/nw-js-chromium-logging-flags-behave-differently-when-specified-in-package-json

needinfo

Most helpful comment

Great work!
Launching from a shortcut with --enable-logging or specifying that switch in package.json's chromium--args the console windows no longer show up!
Thank you!

  • NW.js v. 0.25.5 (nightly) (normal build)
  • Windows 10 Prof. (x64)

All 10 comments

@danielmackenzie , I tried the latest nwjs-sdk-0.20.3, this issue is not reproduced on Windows, could you please try the latest version?

@Christywl , I just tried with version 0.20.3 and got slightly different behaviour. On launch, I get our main window plus one prompt that looks like this:

screenshot

Any idea what might be causing this?

Sorry, I didn't meet this error. @rogerwang , could you please help take a look at this?

This is fixed in git and will be available in the next nightly build.

I still experience this issue with nwjs 0.21.5 on Windows 8.1 and Windows 10:
--enable-logging causes an extra console window \??\C:\WINDOWS\system32\conhost.exe 0x4 with some of the first log lines to open. See here on Windows 8.1 (same on Windows 10) the properties of the shortcut to my application, it's main window (in the background) and the console window (left):
Screenshot on Windows 8.1

This is not happening on Windows 7 (64 and 32 Bit)

There is no difference wether the command line option goes into chromium-args or is specified explicitly in the shortcut.

@danielmackenzie Can you confirm that the bug is not resolved?

@danielmackenzie Please re-open this issue.
@rogerwang This issue is not resolved in version 0.22, please re-open this issue.
When invoked as a GUI process on Windows 8.1 and Windows 10 with --enable-logging NW.js opens an extra Windows Console Window (probably in a call to CreateProcess with the CREATE_NEW_CONSOLE flag.)
Steps to reproduce:

  • Download and extract the latest nw.js package (non-SDK)
  • Create a shortcut to nw.exe (e.g. on the Desktop)
  • append --enable-logging to the link (see screenshot below)
  • double click on the shortcut (The default nw.js GUI window and an additional console window get opened)
    Screenshot on Windows 10

v0.25.0-beta1 also contains this bag.

package.json:

{
    "name": "1",
    "main": "anything.html",
    "chromium-args": "--enable-logging"
}

I create exe with command:

copy /b nw.exe+package.nw app.exe

and run app.exe from explorer. There is additional console window.

If i run app.exe from CMD, there is no this console window.

v0.25.2 also opens a cmd window...

just fixed the console window in git.
It will be available in the next nightly build.

Great work!
Launching from a shortcut with --enable-logging or specifying that switch in package.json's chromium--args the console windows no longer show up!
Thank you!

  • NW.js v. 0.25.5 (nightly) (normal build)
  • Windows 10 Prof. (x64)
Was this page helpful?
0 / 5 - 0 ratings