From 58ecf9d3e486d39f7836cd99186cb6e29ec50121 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 4 Feb 2026 16:21:01 -0800 Subject: [PATCH] actions, privileged_daemon: Drop some unused global statements Tests: - Make a privileged method throw and exception after spewing output to stdout and stderr. The exception caught on the service daemon contains the expected stdout and stderr messages. - Sending SIGTERM to privileged daemon shuts down the daemon. Signed-off-by: Sunil Mohan Adapa --- plinth/actions.py | 3 --- plinth/privileged_daemon.py | 1 - 2 files changed, 4 deletions(-) diff --git a/plinth/actions.py b/plinth/actions.py index 689dc58c1..d1ab50d2c 100644 --- a/plinth/actions.py +++ b/plinth/actions.py @@ -369,7 +369,6 @@ class JSONEncoder(json.JSONEncoder): def _setup_thread_storage(): """Setup collection of stdout/stderr from any process in this thread.""" - global thread_storage thread_storage.stdout = b'' thread_storage.stderr = b'' @@ -380,14 +379,12 @@ def _clear_thread_storage(): Python documentation is silent on whether thread local storage will be cleaned up after a thread terminates. """ - global thread_storage thread_storage.stdout = None thread_storage.stderr = None def get_return_value_from_exception(exception): """Return the value to return from server when an exception is raised.""" - global thread_storage return_value = { 'result': 'exception', 'exception': { diff --git a/plinth/privileged_daemon.py b/plinth/privileged_daemon.py index 3b31ec900..f5120ec25 100644 --- a/plinth/privileged_daemon.py +++ b/plinth/privileged_daemon.py @@ -260,7 +260,6 @@ def _shutdown_server() -> None: This must be run in a thread separate from the server.serve_forever() otherwise it will deadlock waiting for the shutdown to complete. """ - global _server logger.info('SIGTERM received, shutting down the server.') if _server: _server.shutdown()