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: NLucas Meneghel Rodrigues <lmr@redhat.com>
上级 15112745
......@@ -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()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册