diff options
-rw-r--r-- | sos/utilities.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sos/utilities.py b/sos/utilities.py index 453b75f0..a8d4cf81 100644 --- a/sos/utilities.py +++ b/sos/utilities.py @@ -22,6 +22,7 @@ import logging import fnmatch import errno import shlex +import glob from contextlib import closing @@ -133,8 +134,16 @@ def sos_get_command_output(command, timeout=300, stderr=False, if not six.PY3: command = command.encode('utf-8', 'ignore') args = shlex.split(command) + # Expand arguments that are wildcard paths. + expanded_args = [] + for arg in args: + expanded_arg = glob.glob(arg) + if expanded_arg: + expanded_args.extend(expanded_arg) + else: + expanded_args.append(arg) try: - p = Popen(args, shell=False, stdout=PIPE, + p = Popen(expanded_args, shell=False, stdout=PIPE, stderr=STDOUT if stderr else PIPE, bufsize=-1, env=cmd_env, close_fds=True, preexec_fn=_child_prep_fn) |