1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 17:42:20 +03:00

Log when we detect browser running us again to pass Auth response.

This commit is contained in:
Athanasius 2020-10-13 12:21:15 +01:00
parent 4c9cf9ed65
commit 45ab19b6b1

View File

@ -1364,7 +1364,8 @@ def enforce_single_instance() -> None: # noqa: CCR001
and GetProcessHandleFromHwnd(window_handle): and GetProcessHandleFromHwnd(window_handle):
# If GetProcessHandleFromHwnd succeeds then the app is already running as this user # If GetProcessHandleFromHwnd succeeds then the app is already running as this user
if len(sys.argv) > 1 and sys.argv[1].startswith(protocolhandler.redirect): if len(sys.argv) > 1 and sys.argv[1].startswith(protocolhandler.redirect):
# Browser invoked us directly with auth response. Forward the response to the other app instance. logger.debug('Browser invoked us directly with auth response. '
'Forwarding the response to the other app instance.')
CoInitializeEx(0, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE) CoInitializeEx(0, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE)
# Wait for it to be responsive to avoid ShellExecute recursing # Wait for it to be responsive to avoid ShellExecute recursing
ShowWindow(window_handle, SW_RESTORE) ShowWindow(window_handle, SW_RESTORE)