Force command action to not be executed by the shell unless specifically enabled

This commit is contained in:
James Tanner
2014-03-10 16:11:24 -05:00
committed by James Cammarata
parent 9730157525
commit ba0fec4f42
19 changed files with 427 additions and 245 deletions

View File

@@ -207,7 +207,9 @@ class Service(object):
os._exit(0)
# Start the command
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=lambda: os.close(pipe[1]))
if isinstance(cmd, basestring):
cmd = shlex.split(cmd)
p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=lambda: os.close(pipe[1]))
stdout = ""
stderr = ""
fds = [p.stdout, p.stderr]