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

hide_console options don't work on Windows 11 #8022

Open
Safihre opened this issue Oct 20, 2023 · 2 comments
Open

hide_console options don't work on Windows 11 #8022

Safihre opened this issue Oct 20, 2023 · 2 comments

Comments

@Safihre
Copy link
Contributor

Safihre commented Oct 20, 2023

Description of the issue

Based on #8006 I applied hide_console=hide-early, which worked great on my Windows 10 device.
However, users quickly reported that on Windows 11 it does not work, the window just stays open.
I tested it on a Windows 11 laptop, and they seem to be right.

I also tested the other options, like minimize-early, but they also didn't seem to work.

Context information (for bug reports)

  • Output of pyinstaller --version: (paste here)
  • Version of Python: 3.11
  • Platform: Windows 11
  • How you installed Python: python.org/downloads
  • Did you also try this on another platform? Does it work there? Windows 10 works
  • I also tried PyInstaller development version.

A minimal example program which shows the error

import time

print("hello")
time.sleep(30)
 pyinstaller scratch.py --hide-console=hide-early --console
@Safihre Safihre added the triage Please triage and relabel this issue label Oct 20, 2023
@rokm
Copy link
Member

rokm commented Oct 20, 2023

Hmmm, looks like ShowWindow does not work with the shiny new Windows Terminal. Not sure if we can do anything about it, though - aside from putting a warning into documentation.

According to microsoft/terminal#12570, this was addressed in v1.14.143, but then v1.14.145 added microsoft/terminal#13164, and it seems that by now (1.17.11461.0) neither hide nor minimize (even with SW_MINIMIZE (6) instead of SW_SHOWMINNOACTIVE that we currently use) works. microsoft/terminal#12464 seems to be the current issue for SW_HIDE.

If you are creating launcher shortcuts for your users, you might be able to work-around this by explicitly launching the application via old conhost, as described here: nzbget/nzbget#792 (comment)

Safihre added a commit to sabnzbd/sabnzbd that referenced this issue Oct 20, 2023
@buzzwebly
Copy link

buzzwebly commented Oct 30, 2023

Here's a fix for this, it involves setting the Windows 11 Terminal app to default to 'Windows Console Host' instead of 'Windows Terminal' on startup. It's default is Let Windows Decide and it appears to always "decide" on Windows Terminal.

  • Open Terminal

  • To the right of any existing tabs, right click on a blank area of the tab bar
    (or left click on the drop down symbol next to the + sign)
    in either case then choose Settings

  • Once in settings, set 'Default terminal application' to 'Windows Console Host'

  • 'Save' settings

  • Did you remember to save settings?

After doing the above, SABnzbd will start correctly without leaving a terminal window
open.

Note these are not the same set of settings found for Terminal in the app list, so if you can't find it, maybe that's where you went looking. Do the above.

A permanent solution should still be sought since Microsoft will likely remove this option at some point in the future in a bid to get rid of the old console host, but I don't imagine that happening until they've at least fixed the known bugs in Terminal referred to in the earlier posts here. On the other hand, we are talking about Microsoft ;-)

@bwoodsend bwoodsend added bug not-our-bug and removed triage Please triage and relabel this issue labels Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants