-
Notifications
You must be signed in to change notification settings - Fork 206
Description
Describe the bug
PublicClientApplication.acquire_token_interactive
can't be stopped by Ctrl+C.
To Reproduce
- Call
PublicClientApplication.acquire_token_interactive
- Press Ctrl+C
Expected behavior
MSAL should respond to KeyboardInterrupt
.
What you see instead
The terminal hangs. The only way to stop it is Ctrl+Break (https://stackoverflow.com/questions/1364173/stopping-python-using-ctrlc).
The MSAL Python version you are using
1.13.0
Additional context
Azure CLI runs HTTPServer
on a daemon thread so that Ctrl+C can stop the main thread which is time.sleep
ing: https://github.com/Azure/azure-cli/blob/a4d84cc6e7fb6bd741753cb6a52410d0397c56c3/src/azure-cli-core/azure/cli/core/_profile.py#L1383-L1397
Another possible solution is to call HTTPServer.serve_forever
. This is the approach of http.server
when we run
python -m http.server 8000
Per socketserver.BaseServer.serve_forever
, it internally resumes control to the main thread every poll_interval
seconds so that KeyboardInterrupt
can be handled.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status