aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2024-09-19 16:02:21 +0200
committerGuilhem Moulin <guilhem@fripost.org>2024-09-19 16:02:21 +0200
commit43b81443f8f5de08d55461d96e06b180fed37a83 (patch)
tree30d0dbde04322224b3e3c293b2016d8012964864
parent8c73990de91e22021e28ea29c0be6819f5d09eac (diff)
common.py: Add a check for $JOURNAL_STREAM.
$JOURNAL_STREAM is set when the WM is started with `systemd-cat --identifier="sway" sway` or similar. So instead we also check that $SYSTEMD_EXEC_PID points at the current PID. This is due to an incomplete logic in d40c908f9eb768c3f93ae7dc60ee7eb4c358ed4f and 42cfe748e23bad6fc51b14a3e5896a77fdb5c1d5.
-rw-r--r--common.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/common.py b/common.py
index 78fa4fd..79b5de8 100644
--- a/common.py
+++ b/common.py
@@ -32,7 +32,9 @@ def init_logger(app=__file__, level=logging.WARNING):
log = logging.getLogger()
log.setLevel(level)
- if os.getenv('SYSTEMD_EXEC_PID', None) is None or os.getenv('JOURNAL_STREAM', None) is None:
+ pid = os.getenv('SYSTEMD_EXEC_PID', None)
+ if (pid is None or int(pid) != os.getpid()
+ or os.getenv('JOURNAL_STREAM', None) is None):
ch = logging.StreamHandler()
else:
# started in systemd, use journald for filtering incl. coloring