daemon: fix control-panel server crash in the windowed frozen exe
The onefile build is windowed (no console), so sys.stderr is None and uvicorn's default logging dictConfig fails with "Unable to configure formatter 'default'", which took the whole settings-panel server down (the BLE side kept working, but the Settings window couldn't load). Pass log_config=None so uvicorn skips its own logging setup — the daemon has its own file logger and doesn't need uvicorn's. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -153,8 +153,13 @@ def serve_in_thread(port: int | None = None) -> threading.Thread:
|
||||
import uvicorn
|
||||
|
||||
p = port or cfgmod.DEFAULT_PORT
|
||||
# log_config=None disables uvicorn's default dictConfig. In the frozen,
|
||||
# windowed exe there is no console, so sys.stderr is None and uvicorn's
|
||||
# default logging setup dies with "Unable to configure formatter 'default'",
|
||||
# taking the whole control-panel server down. We don't need uvicorn's logs
|
||||
# (the daemon has its own file logger), so skip its logging config entirely.
|
||||
server = uvicorn.Server(uvicorn.Config(
|
||||
app, host="127.0.0.1", port=p, log_level="warning"))
|
||||
app, host="127.0.0.1", port=p, log_level="warning", log_config=None))
|
||||
t = threading.Thread(target=server.run, daemon=True, name="clawd-http")
|
||||
t.start()
|
||||
return t
|
||||
|
||||
Reference in New Issue
Block a user