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

Add qz-tray-console.exe for debugging purposes #828

Merged
merged 3 commits into from
Jun 25, 2021
Merged

Add qz-tray-console.exe for debugging purposes #828

merged 3 commits into from
Jun 25, 2021

Conversation

tresf
Copy link
Contributor

@tresf tresf commented Jun 22, 2021

image

Supersedes #801

@tresf tresf requested a review from klabarge June 22, 2021 21:19
@tresf
Copy link
Contributor Author

tresf commented Jun 23, 2021

@klabarge installer available here.

Note, this was cross-compiled using Ubuntu 20.04 ARM64 edition and the new build flag os.arch via:

ant nsis -Dos.arch=x86

@klabarge
Copy link
Member

When I call the console from cmd ("C:\Program Files\QZ Tray\qz-tray-console.exe"), it launches a new window.

This seems to work as expected. I tried printing some HTML with rasterize: false to test the memory shelf and I didn't run into any memory issues.

Is there anything specific I should test before approving?

image

@tresf
Copy link
Contributor Author

tresf commented Jun 23, 2021

When I call the console from cmd ("C:\Program Files\QZ Tray\qz-tray-console.exe"), it launches a new window.

Good point. Yeah, I hadn't thought about that. If you look at the commit, it's just a small trick that replaces javaw.exe with java.exe and re-builds the launcher.

The memory shelf should be identical to the normal launcher, because it's a copy of it (clones it at compile time, replaces the javaw.exe with java.exe).

The new console can be avoided using some NSIS tricks but it's a hack, so I opted for the simplest solution, which was to just leverage the console version of Java. The reason this happens is because in Windows, you can't have a GUI app and a console app in the same exe and NSIS is a GUI app only unless the NSIS source is recompiled.

The hacks include attaching to a console and writing output, but it would be harder to re-use code and may be less reliable.

Is there anything specific I should test before approving?

I can't think of any.

@klabarge
Copy link
Member

The only problem I see with this behavior is the console closes automatically when the app is no longer running. So if there's a hard crash to QZ Tray, the stack trace containing the error will be lost.

If there's a hard-crash we're trying to debug on Windows, we'll have to use the old method for launching QZ Tray via the console.

@tresf
Copy link
Contributor Author

tresf commented Jun 24, 2021

If there's a hard-crash we're trying to debug on Windows, we'll have to use the old method for launching QZ Tray via the console.

Right, and the old method is growing increasingly difficult. I'll see what I can whip up.

@tresf
Copy link
Contributor Author

tresf commented Jun 25, 2021

@klabarge I've introduced a new technique in 00ff4bd which launches an instance of cmd.exe that will remain open even after a crash.

Installer available here.

@klabarge
Copy link
Member

which launches an instance of cmd.exe that will remain open even after a crash.

I tested this and it works 👍. Approving.

@tresf tresf merged commit f39e9d4 into master Jun 25, 2021
@tresf tresf deleted the win-console branch June 25, 2021 16:40
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

Successfully merging this pull request may close these issues.

2 participants