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

fix: allow the app to display logs when launced from the terminal on windows #238

Merged

Conversation

B0ney
Copy link
Contributor

@B0ney B0ney commented Feb 10, 2024

fixes: #237

While #![windows_subsystem = "windows"] is fine since we don't want the app to create the terminal on startup, this has the consequence of outright disabling terminal output, even if we launch it from the console.

The proposed fix uses windows-sys to attach the process' stout to any available console.
Reference: https://learn.microsoft.com/en-us/windows/console/attachconsole

While this introduces a new dependency, since they're raw FFI calls for the windows-api, they should add little to no overhead.

@AnonymousWP AnonymousWP requested a review from a team February 10, 2024 14:28
Copy link
Contributor

@lavafroth lavafroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please update your branch with the main branch? Also, you could possibly look into this crate.

@lavafroth
Copy link
Contributor

lavafroth commented Feb 10, 2024

I'm unable to test this right now due to the lack of a windows machine.
@adhirajsinghchauhan, could you test these changes?

@B0ney
Copy link
Contributor Author

B0ney commented Feb 10, 2024

Done!

win32console does the job. My only complaint is that it doesn't seem to provide a ATTACH_PARENT_PROCESS constant or something equivalent.

@Frigyes06
Copy link
Member

I can test later today

lavafroth
lavafroth previously approved these changes Feb 11, 2024
Copy link
Contributor

@lavafroth lavafroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@lavafroth lavafroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unsuccessful CI runs are due to a linting issue from a previous PR. Thanks a lot again!

@AnonymousWP AnonymousWP added the bug Something isn't working label Feb 11, 2024
@lavafroth lavafroth merged commit 2cccec2 into Universal-Debloater-Alliance:main Feb 12, 2024
2 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(windows): Running the application from the terminal doesn't show any logs
4 participants