diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2014-04-06 18:01:33 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2014-04-06 18:01:33 +0100 |
commit | 46b6c3d39f923d19fa7fcfec96c1cf2d23c768be (patch) | |
tree | 8033accc0cc395eb51ba1080a57559196206df8d | |
parent | c2d90b7db3b72fb58704108bda27f58e9a68b347 (diff) | |
download | sos-46b6c3d39f923d19fa7fcfec96c1cf2d23c768be.tar.gz |
Call Popen with shell=False
Fixes Issue #253.
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r-- | sos/utilities.py | 4 |
1 files changed, 3 insertions, 1 deletions
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) |