mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
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 <sunil@medhas.org>
This commit is contained in:
parent
3cb5d1a936
commit
58ecf9d3e4
@ -369,7 +369,6 @@ class JSONEncoder(json.JSONEncoder):
|
|||||||
|
|
||||||
def _setup_thread_storage():
|
def _setup_thread_storage():
|
||||||
"""Setup collection of stdout/stderr from any process in this thread."""
|
"""Setup collection of stdout/stderr from any process in this thread."""
|
||||||
global thread_storage
|
|
||||||
thread_storage.stdout = b''
|
thread_storage.stdout = b''
|
||||||
thread_storage.stderr = b''
|
thread_storage.stderr = b''
|
||||||
|
|
||||||
@ -380,14 +379,12 @@ def _clear_thread_storage():
|
|||||||
Python documentation is silent on whether thread local storage will be
|
Python documentation is silent on whether thread local storage will be
|
||||||
cleaned up after a thread terminates.
|
cleaned up after a thread terminates.
|
||||||
"""
|
"""
|
||||||
global thread_storage
|
|
||||||
thread_storage.stdout = None
|
thread_storage.stdout = None
|
||||||
thread_storage.stderr = None
|
thread_storage.stderr = None
|
||||||
|
|
||||||
|
|
||||||
def get_return_value_from_exception(exception):
|
def get_return_value_from_exception(exception):
|
||||||
"""Return the value to return from server when an exception is raised."""
|
"""Return the value to return from server when an exception is raised."""
|
||||||
global thread_storage
|
|
||||||
return_value = {
|
return_value = {
|
||||||
'result': 'exception',
|
'result': 'exception',
|
||||||
'exception': {
|
'exception': {
|
||||||
|
|||||||
@ -260,7 +260,6 @@ def _shutdown_server() -> None:
|
|||||||
This must be run in a thread separate from the server.serve_forever()
|
This must be run in a thread separate from the server.serve_forever()
|
||||||
otherwise it will deadlock waiting for the shutdown to complete.
|
otherwise it will deadlock waiting for the shutdown to complete.
|
||||||
"""
|
"""
|
||||||
global _server
|
|
||||||
logger.info('SIGTERM received, shutting down the server.')
|
logger.info('SIGTERM received, shutting down the server.')
|
||||||
if _server:
|
if _server:
|
||||||
_server.shutdown()
|
_server.shutdown()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user