executable: quote arguments

This allows command line arguments with spaces to be shown. The quoting
madness is because a single quote cannot appear within a single quoted
argument on the command line. To do so, you have to stop the single
quote argument, double quote the single quote, then open the single
quote again:

    $ echo 'before'"'"'after'
    before'after

Fixes #174
This commit is contained in:
Ben Boeckel 2016-03-30 16:08:09 -04:00 committed by Ben Boeckel
parent fa02f94ca4
commit ff9145f8a5

View File

@ -144,7 +144,7 @@ def streamify(arg, mode):
cmd = self.exe + list(args)
cmd_line = ' '.join(cmd)
cmd_line = "'%s'" % "' '".join(map(lambda arg: arg.replace("'", "'\"'\"'"), cmd))
tty.debug(cmd_line)
try: