diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py
index fc27b789d062ea8ff2da153fcb6af6d2a018c8c7..25819b6fc75abe4c0ec8fa710feacd2dce34be8a 100644
--- a/lib/spack/spack/util/executable.py
+++ b/lib/spack/spack/util/executable.py
@@ -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: