fixes with independent process spawning

This commit is contained in:
Mario Voigt 2021-05-20 14:38:01 +02:00
parent e02bfadbca
commit 2d0448e913
2 changed files with 2 additions and 8 deletions

View File

@ -6,7 +6,6 @@ import shutil
import os import os
import sys import sys
import warnings import warnings
import shlex
""" """
Extension for InkScape 1.X Extension for InkScape 1.X
@ -41,9 +40,7 @@ class AnimateOrder (inkex.EffectExtension):
if os.name == 'nt': if os.name == 'nt':
subprocess.Popen(args, close_fds=True, creationflags=DETACHED_PROCESS) subprocess.Popen(args, close_fds=True, creationflags=DETACHED_PROCESS)
else: else:
cmd = "nohup " + " ".join(args) + " &" subprocess.Popen(args, start_new_session=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
cmds = shlex.split(cmd)
subprocess.Popen(cmds, start_new_session=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
warnings.simplefilter("default", ResourceWarning) warnings.simplefilter("default", ResourceWarning)
def add_arguments(self, pars): def add_arguments(self, pars):

View File

@ -8,7 +8,6 @@ import os
import sys import sys
import subprocess import subprocess
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
import shlex
import warnings import warnings
import inkex import inkex
import inkex.command import inkex.command
@ -47,9 +46,7 @@ class ExportObject(inkex.EffectExtension):
if os.name == 'nt': if os.name == 'nt':
Popen(["inkscape", file], close_fds=True, creationflags=DETACHED_PROCESS) Popen(["inkscape", file], close_fds=True, creationflags=DETACHED_PROCESS)
else: else:
cmd = "nohup inkscape " + file + " &" subprocess.Popen(["inkscape", file], start_new_session=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
cmds = shlex.split(cmd)
subprocess.Popen(cmds, start_new_session=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
warnings.simplefilter("default", ResourceWarning) warnings.simplefilter("default", ResourceWarning)
def effect(self): def effect(self):