Files
wehub-resource-sync e9a2f726c9
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / test (3.13) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:29:51 +08:00

28 lines
711 B
Python

# SPDX-License-Identifier: Apache-2.0
"""Best-effort process title helpers."""
from __future__ import annotations
import sys
DEFAULT_PROCESS_TITLE = "omlx-server"
def set_process_title(title: str = DEFAULT_PROCESS_TITLE) -> bool:
"""Set the process title when optional platform support is available.
Returns True when the native process title was updated. If the optional
dependency is not installed, argv[0] is still updated for Python-level
command-line displays and the function returns False.
"""
if title:
sys.argv[0] = title
try:
from setproctitle import setproctitle
except ImportError:
return False
setproctitle(title)
return True