From 46b6c3d39f923d19fa7fcfec96c1cf2d23c768be Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Sun, 6 Apr 2014 18:01:33 +0100 Subject: Call Popen with shell=False Fixes Issue #253. Signed-off-by: Bryn M. Reeves --- sos/utilities.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sos/utilities.py b/sos/utilities.py index 1bc54879..d3115f84 100644 --- a/sos/utilities.py +++ b/sos/utilities.py @@ -34,6 +34,7 @@ import tarfile import hashlib import logging import fnmatch +import shlex from contextlib import closing @@ -144,7 +145,8 @@ def sos_get_command_output(command, timeout=300, runat=None): if timeout and is_executable("timeout"): command = "timeout %ds %s" % (timeout, command) - p = Popen(command, shell=True, stdout=PIPE, stderr=STDOUT, + args = shlex.split(command) + p = Popen(args, shell=False, stdout=PIPE, stderr=STDOUT, bufsize=-1, env = cmd_env, close_fds = True, preexec_fn=_child_chdir) -- cgit