simplify command execution
This commit is contained in:
parent
ba5613cf62
commit
c8ddb121d0
@ -14,6 +14,7 @@ import signal
|
|||||||
import sys
|
import sys
|
||||||
import socket
|
import socket
|
||||||
import logging
|
import logging
|
||||||
|
import shlex
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -241,7 +242,13 @@ class SdrSource(object):
|
|||||||
self.port,
|
self.port,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# don't use shell mode for commands without piping
|
||||||
|
if "|" in cmd:
|
||||||
self.process = subprocess.Popen(cmd, shell=True, preexec_fn=os.setpgrp)
|
self.process = subprocess.Popen(cmd, shell=True, preexec_fn=os.setpgrp)
|
||||||
|
else:
|
||||||
|
# preexec_fn 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)
|
||||||
logger.info("Started rtl source: " + cmd)
|
logger.info("Started rtl source: " + cmd)
|
||||||
|
|
||||||
available = False
|
available = False
|
||||||
|
Loading…
Reference in New Issue
Block a user