-
-
Notifications
You must be signed in to change notification settings - Fork 605
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
Window does not close when stopping native mode with Ctrl-C on Windows #604
Comments
uvicorn has similar issues: |
We will wait a bit longer for the uvicorn issue to evlolve. |
@rodja Issue encode/uvicorn#1872 is from Feb 21 and still tagged as "needs confirmation". Anyway, I'll tag our issue as "waiting" and move it to "Later". Feel free to revert. |
Hai, you can implement a fix for this yourself! if sys.platform == "win32":
import win32api
import os
win32api.SetConsoleCtrlHandler(lambda a=None: os.kill(os.getpid(), 15)) # Enables ctrl+C to kill the terminal on Windows. 15 == signal.SIGTERM |
@ItsCubeTime cool. Would you care to create a pull request to close this bug? |
Good news for encode/uvicorn#1872:
So maybe we can resolve our issue soon by updating uvicorn. |
Looks like encode/uvicorn#1872 has been closed based on PR encode/uvicorn#1584 which was merged already on April 13. According to the milestone and the release notes, it should have been released on April 28 with uvicorn 0.22.0. @al-eax and @ItsCubeTime, can you check if the issue is gone with uvicorn 0.22.0? Thanks! |
Nope, the problem remains with uvicorn 0.22.0 and NiceGUI 1.3.5 on Windows. 😕 |
Looks like a pywebview issue. The example from https://pywebview.flowrl.com/#hello-world has the same problem: import webview
webview.create_window('Hello world', 'https://pywebview.flowrl.com/')
webview.start() |
As far as I understand, pywebview needs to run in the main thread, therefore eating the SIGINT/SIGTERM signal. native_mode.py (line 109) or have some kind of message one could send to the pywebview process, similar to how get_size and so on work, in order to cleanly terminate the process. |
@miningmanna Have you tried setting |
@falkoschindler I tried it on a Windows 10 and Windows 11 machine. It works on both. |
Amazing! The argument For a bit more context, this is how ChatGPT describes its function:
So since the window process shouldn't run without the main process, setting |
As already mentioned on #584, the native application does not terminate correctly with Ctrl-C on Windows.
The text was updated successfully, but these errors were encountered: