Bug 791574 - Use a Unix-compatible list2cmdline. r=terrence.

Sadly, subprocess.list2cmdline only seems to do something sensible for Windows, which I find rather bizarre. This patch fixes the problem where -s can give you something like

  ./js -e option(\'allow_xml\'); -f ...

which is totally invalid in bash.
This commit is contained in:
Steve Fink 2012-09-18 09:58:31 -07:00
Родитель 8fff885092
Коммит 3ddb2b3328
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -1,6 +1,10 @@
import re
from subprocess import list2cmdline
from progressbar import NullProgressBar, ProgressBar
import pipes
# subprocess.list2cmdline does not properly escape for sh-like shells
def escape_cmdline(args):
return ' '.join([ pipes.quote(a) for a in args ])
class TestOutput:
"""Output from a test run."""
@ -107,7 +111,7 @@ class ResultsSink:
self.n += 1
else:
if self.options.show_cmd:
print >> self.fp, list2cmdline(output.cmd)
print >> self.fp, escape_cmdline(output.cmd)
if self.options.show_output:
print >> self.fp, ' rc = %d, run time = %f' % (output.rc, output.dt)