diff options
author | Ben Boeckel <mathstuf@gmail.com> | 2016-03-30 16:08:09 -0400 |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2016-04-25 09:44:17 -0400 |
commit | ff9145f8a5a95808d43db1dbc40414e644448419 (patch) | |
tree | 593cd99c4ae57710590a50347566124a975dd4f4 | |
parent | fa02f94ca4bada75cca4248665bbc007412294c5 (diff) | |
download | spack-ff9145f8a5a95808d43db1dbc40414e644448419.tar.gz spack-ff9145f8a5a95808d43db1dbc40414e644448419.tar.bz2 spack-ff9145f8a5a95808d43db1dbc40414e644448419.tar.xz spack-ff9145f8a5a95808d43db1dbc40414e644448419.zip |
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
-rw-r--r-- | lib/spack/spack/util/executable.py | 2 |
1 files changed, 1 insertions, 1 deletions
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: |