From 470fc43646e953f4aa15be3c28abe5b33c307ee9 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Fri, 17 Jan 2020 21:18:02 +0100 Subject: [PATCH] avoid using preexec_fn in the other places, too --- csdr/csdr.py | 6 +++--- owrx/source/__init__.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/csdr/csdr.py b/csdr/csdr.py index d6cfc11..b2f2129 100644 --- a/csdr/csdr.py +++ b/csdr/csdr.py @@ -329,7 +329,7 @@ class dsp(object): logger.debug("secondary command (fft) = %s", secondary_command_fft) self.secondary_process_fft = subprocess.Popen( - secondary_command_fft, stdout=subprocess.PIPE, shell=True, preexec_fn=os.setpgrp, env=my_env + secondary_command_fft, stdout=subprocess.PIPE, shell=True, start_new_session=True, env=my_env ) self.output.send_output( "secondary_fft", @@ -341,7 +341,7 @@ class dsp(object): # it would block if not read. by piping it to devnull, we avoid a potential pitfall here. secondary_output = subprocess.DEVNULL if self.isPacket() else subprocess.PIPE self.secondary_process_demod = subprocess.Popen( - secondary_command_demod, stdout=secondary_output, shell=True, preexec_fn=os.setpgrp, env=my_env + secondary_command_demod, stdout=secondary_output, shell=True, start_new_session=True, env=my_env ) self.secondary_processes_running = True @@ -669,7 +669,7 @@ class dsp(object): my_env["CSDR_PRINT_BUFSIZES"] = "1" out = subprocess.PIPE if self.output.supports_type("audio") else subprocess.DEVNULL - self.process = subprocess.Popen(command, stdout=out, shell=True, preexec_fn=os.setpgrp, env=my_env) + self.process = subprocess.Popen(command, stdout=out, shell=True, start_new_session=True, env=my_env) def watch_thread(): rc = self.process.wait() diff --git a/owrx/source/__init__.py b/owrx/source/__init__.py index 77e56e0..cb050f2 100644 --- a/owrx/source/__init__.py +++ b/owrx/source/__init__.py @@ -145,13 +145,13 @@ class SdrSource(ABC): if len(cmd) > 1: # multiple commands with pipes cmd = "|".join(cmd) - self.process = subprocess.Popen(cmd, shell=True, preexec_fn=os.setpgrp) + self.process = subprocess.Popen(cmd, shell=True, start_new_session=True) else: # single command cmd = cmd[0] - # preexec_fn can go as soon as there's no piped commands left + # start_new_session can go as soon as there's no piped commands left # the os.killpg call must be replaced with something more reasonable at the same time - self.process = subprocess.Popen(shlex.split(cmd), preexec_fn=os.setpgrp) + self.process = subprocess.Popen(shlex.split(cmd), start_new_session=True) logger.info("Started sdr source: " + cmd) available = False