Execute test commands always with shell

There is no need to handle tests on Windows and Unix differently here.
Always using a shell allows for more flexibility when writing tests.

(rebased by hassec)
main
Alexander Steffen 5 years ago committed by Christoph Hasse
parent 73efa4515c
commit fa4ce38d77

@ -5,33 +5,18 @@ import os
import inspect
import subprocess
import threading
import shlex
import sys
import shutil
import string
import unittest
from bash_tests import utils as BT
if sys.platform in [ 'win32', 'msys', 'cygwin' ]:
#: invoke subprocess.Popen with shell=True on Windows
_SUBPROCESS_SHELL = True
def _cmd_splitter(cmd):
return cmd
def _process_output_post(output):
return output.replace('\r\n', '\n')
else:
#: invoke subprocess.Popen with shell=False on Unix
_SUBPROCESS_SHELL = False
def _cmd_splitter(cmd):
return shlex.split(cmd)
def _process_output_post(output):
return output
@ -586,13 +571,13 @@ def test_run(self):
)
proc = subprocess.Popen(
_cmd_splitter(command),
command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE if stdin is not None else None,
env=self._get_env(),
cwd=self.work_dir,
shell=_SUBPROCESS_SHELL
shell=True,
)
# Setup a threading.Timer which will terminate the command if it takes

Loading…
Cancel
Save