mirror of
https://github.com/rio-labs/rio.git
synced 2026-05-02 08:59:27 -05:00
fix debugger detection
This commit is contained in:
@@ -3130,6 +3130,11 @@ a.remove();
|
||||
self,
|
||||
properties_to_serialize: IdentityDefaultDict[object, set[str]],
|
||||
):
|
||||
# TODO: This function can probably be optimized in some way. Ideas:
|
||||
# 1. Maintain a permanent `component_level` cache
|
||||
# 2. Find the topmost components at the start and then just iteratively
|
||||
# yield their children
|
||||
|
||||
components_to_build = set[rio.Component]()
|
||||
permanent_component_level_cache: dict[rio.Component, int] = {}
|
||||
|
||||
|
||||
@@ -28,7 +28,23 @@ __all__ = ["BrowserClient", "prepare_browser_client"]
|
||||
#
|
||||
# Note: Chrome's console doesn't show `console.debug` messages per default. To
|
||||
# see them, click on "All levels" and check "Verbose".
|
||||
DEBUGGER_ACTIVE = sys.gettrace() is not None
|
||||
def debugger_active():
|
||||
try:
|
||||
if sys.gettrace() is not None:
|
||||
return True
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
if sys.monitoring.get_tool(sys.monitoring.DEBUGGER_ID) is not None: # type: ignore
|
||||
return True
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
return False
|
||||
|
||||
|
||||
DEBUGGER_ACTIVE = debugger_active()
|
||||
|
||||
|
||||
server_manager: ServerManager | None = None
|
||||
|
||||
Reference in New Issue
Block a user