From fc8783ee133dffafe7c8dfbf520dda2ce0ba5ae2 Mon Sep 17 00:00:00 2001 From: tobi-wan-kenobi Date: Sun, 28 Jun 2020 10:44:30 +0200 Subject: [PATCH] [util/cli] fix CLI invokation for sway in sway/wayland, make sure that the wayland socket is cleared, which seems to cause issue for some unspecified reason. also, while at it, improve code so that the environment dict that is passed in is *not* modified. fixes #628 --- bumblebee_status/util/cli.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bumblebee_status/util/cli.py b/bumblebee_status/util/cli.py index 8b39aab..d14dc6a 100644 --- a/bumblebee_status/util/cli.py +++ b/bumblebee_status/util/cli.py @@ -33,14 +33,19 @@ def execute( if not env: env = os.environ.copy() - env["LC_ALL"] = "C" + + myenv = env.copy() + + myenv["LC_ALL"] = "C" + if "WAYLAND_SOCKET" in myenv: + del myenv["WAYLAND_SOCKET"] try: proc = subprocess.Popen( args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT if include_stderr else subprocess.PIPE, - env=env, + env=myenv, shell=shell, ) except FileNotFoundError as e: