Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node program output no longer shown in Console view #1365

Closed
AndrewFerr opened this issue Oct 13, 2023 · 10 comments · Fixed by #1368 or #1372
Closed

Node program output no longer shown in Console view #1365

AndrewFerr opened this issue Oct 13, 2023 · 10 comments · Fixed by #1368 or #1372

Comments

@AndrewFerr
Copy link
Member

With WWD 1.3.1.202310101531, running or debugging a JS/TS file no longer has its standard output/error shown in the Console view.

All that's shown in the Console view is this:

/<path-to-eclipse>/.node/node-v18.18.0-linux-x64/bin/node ./<path-to-launched-file>

followed by

Process exited with code 1

once the program exits.

There is also another Console view created for the debug adapter, but that isn't for program output.

Notably, running the exact same command (and in the same working directory as what the Eclipse launch uses) from a separate terminal does show program output, so it's not as though there's an issue with the plugin's embedded Node.

@mickaelistria
Copy link
Contributor

Is there anything that confirms that the program has run well (maybe some modified file or something else)?
I've seen occurrences of this bug with the new debug adapter for very quick programs. I suspect it's the debug adapter that is a bit late at sending the console output event, and that sends termination earlier. I don't know yet if this is a vscode-js-debug issue or a LSP4E/DAP integration issue (which would abort connection too early).

@AndrewFerr
Copy link
Member Author

This happens with long-running programs as well.

But it turns out the problem is that only certain kinds of logs don't appear. The project I'm working on uses a logger based winston; anything sent to those logs doesn't appear in the Console view, but anything sent to console.log and such does appear.

@mickaelistria
Copy link
Contributor

How does VSCode handle this case? Does it show all logs?

@AndrewFerr
Copy link
Member Author

Ah, interesting: it does show all logs, but only in the "Terminal" view, which is used only when launching the program via a "node-terminal" launch configuration.

In all cases, any output shown the "Debug Console" view exhibits the same behaviour as WWD (i.e. it only shows console.log output).

@mickaelistria
Copy link
Contributor

OK.
I'm not much aware of whether Wild Web Developer would better use node-terminal instead of node-pwa launch type. Can you advise here?

@mickaelistria
Copy link
Contributor

@AndrewFerr
Copy link
Member Author

Nice find! Setting "outputCapture": "std" in my VSCode project indeed causes the Debug Console to show all logs. Using that in WWD should thus let Eclipse's Console view show all logs without having to change the launch type.

Using the node-terminal launch type might work too, but that may require other changes to be fully supported in WWD, as it launches an interactive terminal that may need to be set up with stdin.

@mickaelistria
Copy link
Contributor

Do you think "std" should be the default in Wild Web Developer?

@AndrewFerr
Copy link
Member Author

Do you think "std" should be the default in Wild Web Developer?

Yes, because with the previous debug adapter, the Console used to show all output, making the new behaviour a regression. Also, unlike VSCode's Terminal view, there is no alternate view in WWD which displays more than just the "console" output of a Node program.

@mickaelistria
Copy link
Contributor

OK. Would you like to submit a PR setting std to true?

AndrewFerr added a commit to AndrewFerr/wildwebdeveloper that referenced this issue Oct 19, 2023
mickaelistria pushed a commit that referenced this issue Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants