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

no output from t_print() macro function in cmd.exe or powershell #303

Open
tksoh opened this issue Jan 31, 2021 · 4 comments
Open

no output from t_print() macro function in cmd.exe or powershell #303

tksoh opened this issue Jan 31, 2021 · 4 comments

Comments

@tksoh
Copy link
Contributor

tksoh commented Jan 31, 2021

I've been using t_print() to print debug messages from my macros without issue when running NG release build from within Qt Creator, where the output of t_print() are captured in the Application Output tab. Running NG from terminal on Linux has been working well too.

However, when I ran the same release build from cmd.exe or Powershell on Windows 10, I don't get any output from t_print() at all.

Is this expected?

Using commit b43c9af

2021-01-31 17_53_16-DocumentWidget cpp (src @ nedit-ng)  master  - Qt Creator

2021-01-31 17_54_52-TextArea cpp - C__Users_teeka_OneDrive_Documents_projects_nedit-ng_src_

2021-01-31 17_55_53-TextArea cpp - C__Users_teeka_OneDrive_Documents_projects_nedit-ng_src_

@eteran
Copy link
Owner

eteran commented Jan 31, 2021

It is technically "expected", but not necessarily desirable.

Basically, Windows apps can be either console or graphical, and a graphical app doesn't have its stdout/stderr/stdin connected to the terminal which launched it.

This is fixable though :-)

It's actually something I've looked into before and found a solution for eventually!

https://stackoverflow.com/questions/311955/redirecting-cout-to-a-console-in-windows

@tksoh
Copy link
Contributor Author

tksoh commented Feb 1, 2021

Glad you know you already looked into this before. I wonder how Qt Creator is able to capture the messages. Perhaps it's not really running the same exe we run on cmd.exe?

In any case, this printing to console approach is never the right one to me from the get-go (hence this 15-year-old SF patch), as it's impractical to have to keep track of which terminal nedit will be printing the messages. We should really add a log window to display the messages, which would seem like to pretty easy hack for you ;-)

@eteran
Copy link
Owner

eteran commented Feb 1, 2021

Oh, well I assume that Qt Creator doesn't use cmd.exe at all and just launches it with CreateProcessEx. Then it can redirect the stdout/stderr of the process to where it pleases, including it's own debug output pane

@eteran
Copy link
Owner

eteran commented Feb 1, 2021

And yes, we can do something similar and create a fancy log window :-). That's definitely in the plan. Just a matter of figuring out minor aesthetics of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants