2222import argparse
2323import glob
2424import os
25- import re
2625import stat
2726import subprocess
2827import sys
@@ -311,15 +310,6 @@ def get_template_command(filetype, verb=None):
311310 return buf .value
312311
313312
314- _ws = re .compile (r'\s' )
315-
316- def escape (s ):
317- if _ws .search (s ):
318- s = '"' + s + '"'
319- s = s .replace ('\\ ' , '\\ \\ ' )
320- return s
321-
322-
323313if not catch_output :
324314 # Without any output suppressed, we let the subprocess
325315 # write its stuff freely to stdout/stderr.
@@ -432,8 +422,7 @@ class PopenExecutor(RuntestBase):
432422
433423 A bit of a misnomer as the Popen call is now wrapped
434424 by calling subprocess.run (behind the covers uses Popen.
435- Very similar to SystemExecutor, but uses command_str
436- instead of command_args, and doesn't allow for not catching
425+ Very similar to SystemExecutor, but doesn't allow for not catching
437426 the output).
438427 """
439428 # For an explanation of the following 'if ... else'
@@ -447,7 +436,7 @@ def execute(self, env):
447436 tmp_stderr = tempfile .TemporaryFile (mode = 'w+t' )
448437 # Start subprocess...
449438 cp = subprocess .run (
450- self .command_str . split () ,
439+ self .command_args ,
451440 stdout = tmp_stdout ,
452441 stderr = tmp_stderr ,
453442 shell = False ,
@@ -470,7 +459,7 @@ def execute(self, env):
470459
471460 def execute (self , env ):
472461 cp = subprocess .run (
473- self .command_str . split () ,
462+ self .command_args ,
474463 stdout = subprocess .PIPE ,
475464 stderr = subprocess .PIPE ,
476465 shell = False ,
@@ -784,7 +773,7 @@ def run_test(t, io_lock=None, run_async=True):
784773 if args .runner and t .path in unittests :
785774 # For example --runner TestUnit.TAPTestRunner
786775 command_args .append ('--runner ' + args .runner )
787- t .command_args = [escape ( args .python ) ] + command_args
776+ t .command_args = [args .python ] + command_args
788777 t .command_str = " " .join (t .command_args )
789778 if args .printcommand :
790779 if args .print_progress :
0 commit comments