mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-19 19:59:11 +08:00
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
This commit is contained in:
parent
f9ad274e28
commit
db6157f6f8
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user