Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CURA-12091 fix infill plugin start crash #19599

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
13 changes: 11 additions & 2 deletions cura/BackendPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import socket
import os
import subprocess
import pathlib
from typing import Optional, List

from UM.Logger import Logger
Expand Down Expand Up @@ -74,7 +75,8 @@ def start(self) -> bool:
"""
if not self.usePlugin():
return False
Logger.info(f"Starting backend_plugin [{self._plugin_id}] with command: {self._validatePluginCommand()}")
validated_plugin_command = self._validatePluginCommand()
Logger.info(f"Starting backend_plugin [{self._plugin_id}] with command: {validated_plugin_command}")
plugin_log_path = os.path.join(Resources.getDataStoragePath(), f"{self.getPluginId()}.log")
if os.path.exists(plugin_log_path):
try:
Expand All @@ -93,7 +95,14 @@ def start(self) -> bool:
}
if Platform.isWindows():
popen_kwargs["creationflags"] = subprocess.CREATE_NO_WINDOW
self._process = subprocess.Popen(self._validatePluginCommand(), **popen_kwargs)

plugin_env = os.environ
if Platform.isLinux() and len(validated_plugin_command) > 0:
# Add plugin directory to AppImage "modules" directory so that it is started as if it was
# part of the AppImage and uses the sames libraries
plugin_env["APPDIR_MODULE_DIR"] = str(pathlib.Path(validated_plugin_command[0]).parent.absolute())

self._process = subprocess.Popen(validated_plugin_command, env=plugin_env, **popen_kwargs)
self._is_running = True
return True
except PermissionError:
Expand Down
Loading