avoid using preexec_fn in the other places, too

This commit is contained in:
Jakob Ketterl 2020-01-17 21:18:02 +01:00
parent ea5b5dc8fb
commit 470fc43646
2 changed files with 6 additions and 6 deletions

View File

@ -329,7 +329,7 @@ class dsp(object):
logger.debug("secondary command (fft) = %s", secondary_command_fft) logger.debug("secondary command (fft) = %s", secondary_command_fft)
self.secondary_process_fft = subprocess.Popen( 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( self.output.send_output(
"secondary_fft", "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. # 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 secondary_output = subprocess.DEVNULL if self.isPacket() else subprocess.PIPE
self.secondary_process_demod = subprocess.Popen( 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 self.secondary_processes_running = True
@ -669,7 +669,7 @@ class dsp(object):
my_env["CSDR_PRINT_BUFSIZES"] = "1" my_env["CSDR_PRINT_BUFSIZES"] = "1"
out = subprocess.PIPE if self.output.supports_type("audio") else subprocess.DEVNULL 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(): def watch_thread():
rc = self.process.wait() rc = self.process.wait()

View File

@ -145,13 +145,13 @@ class SdrSource(ABC):
if len(cmd) > 1: if len(cmd) > 1:
# multiple commands with pipes # multiple commands with pipes
cmd = "|".join(cmd) 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: else:
# single command # single command
cmd = cmd[0] 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 # 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) logger.info("Started sdr source: " + cmd)
available = False available = False