From fa4ce38d77a6428e111a8a542396e79bb0e379ba Mon Sep 17 00:00:00 2001 From: Alexander Steffen Date: Wed, 9 Dec 2020 10:36:17 +0100 Subject: [PATCH] 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) --- tests/system_tests.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/tests/system_tests.py b/tests/system_tests.py index e1e95186..8d37bd56 100644 --- a/tests/system_tests.py +++ b/tests/system_tests.py @@ -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