From b6ccb18a6d8b91837e8e9404d76b4d3bc025eede Mon Sep 17 00:00:00 2001 From: Lucas Meneghel Rodrigues Date: Wed, 20 Aug 2014 14:22:39 -0300 Subject: [PATCH] avocado.utils.process: Execute commands on a subshell For a number of reasons, the original implementation called the processes with shell=False (subprocess default), I noticed later that we lose things like the ability to use pipes in commands executed and proper job control and process handling. So change that and use shell=True. Signed-off-by: Lucas Meneghel Rodrigues --- avocado/utils/process.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/avocado/utils/process.py b/avocado/utils/process.py index f47d16f5..200ac765 100644 --- a/avocado/utils/process.py +++ b/avocado/utils/process.py @@ -20,7 +20,6 @@ import logging import os import StringIO import signal -import shlex import subprocess import time import threading @@ -117,13 +116,13 @@ class SubProcess(object): :param verbose: Whether to log the command run and stdout/stderr. :type verbose: bool """ - args = shlex.split(cmd) self.verbose = verbose if self.verbose: log.info("Running '%s'", cmd) - self.sp = subprocess.Popen(args, + self.sp = subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stderr=subprocess.PIPE, + shell=True) self.start_time = time.time() self.result = CmdResult(cmd) self.stdout_file = StringIO.StringIO() -- GitLab