From db6157f6f824015b6c1d79462511450d244d5a83 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Mon, 26 Feb 2024 18:17:54 +0100 Subject: [PATCH] Refactor plugin start process in BackendPlugin This commit simplifies the process of starting plugins in BackendPlugin.py. The changes include removal of unnecessary code for setting LD_LIBRARY_PATH and converting the assigned environment to a dictionary. This leads to cleaner, more maintainable code. Contribute to CURA-11356 --- cura/BackendPlugin.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/cura/BackendPlugin.py b/cura/BackendPlugin.py index b3c236535b..fda09165bb 100644 --- a/cura/BackendPlugin.py +++ b/cura/BackendPlugin.py @@ -90,15 +90,12 @@ class BackendPlugin(AdditionalSettingDefinitionsAppender, PluginObject): "stdin": None, "stdout": f, # Redirect output to file "stderr": subprocess.STDOUT, # Combine stderr and stdout - "env": os.environ + "env": dict(os.environ) } - run_prep_cmd = "" if Platform.isWindows(): popen_kwargs["creationflags"] = subprocess.CREATE_NO_WINDOW - else: - run_prep_cmd = f"LD_LIBRARY_PATH={os.environ['LD_LIBRARY_PATH']}:$LD_LIBRARY_PATH " Logger.info(f"Starting plugin with: {popen_kwargs}") - self._process = subprocess.Popen(f"{run_prep_cmd}{self._validatePluginCommand()}", **popen_kwargs) + self._process = subprocess.Popen(self._validatePluginCommand(), **popen_kwargs) self._is_running = True return True except PermissionError: