From ff9145f8a5a95808d43db1dbc40414e644448419 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 30 Mar 2016 16:08:09 -0400 Subject: 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 --- lib/spack/spack/util/executable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py index fc27b789d0..25819b6fc7 100644 --- a/lib/spack/spack/util/executable.py +++ b/lib/spack/spack/util/executable.py @@ -144,7 +144,7 @@ class Executable(object): cmd = self.exe + list(args) - cmd_line = ' '.join(cmd) + cmd_line = "'%s'" % "' '".join(map(lambda arg: arg.replace("'", "'\"'\"'"), cmd)) tty.debug(cmd_line) try: -- cgit v1.2.3-60-g2f50