changeset 74e7b9b5029c in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=74e7b9b5029c
description:
        misc: quote args in echoed command line

        Currently if there are shell special characters in a
        command-line argument, you can't copy and paste the
        echoed command line onto a shell prompt because the
        characters aren't quoted properly.  This patch fixes
        that problem.

diffstat:

 src/python/m5/main.py |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (16 lines):

diff -r 8a4040874157 -r 74e7b9b5029c src/python/m5/main.py
--- a/src/python/m5/main.py     Mon Mar 23 06:57:38 2015 -0400
+++ b/src/python/m5/main.py     Mon Mar 23 16:14:18 2015 -0700
@@ -293,9 +293,9 @@
             datetime.datetime.now().strftime("%b %e %Y %X")
         print "gem5 executing on %s" % socket.gethostname()
 
-        print "command line:",
-        for argv in sys.argv:
-            print argv,
+        # in Python 3 pipes.quote() is moved to shlex.quote()
+        import pipes
+        print "command line:", " ".join(map(pipes.quote, sys.argv))
         print
 
     # check to make sure we can find the listed script
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to