Really fix shell quoting, quoting single quotes correctly.

This commit is contained in:
Bastian Kleineidam 2010-04-04 20:29:14 +02:00
parent 6e2433aa00
commit b8d2d81d00
1 changed files with 3 additions and 2 deletions

View File

@ -270,8 +270,9 @@ def tmpfile (dir=None, prefix="temp", suffix=None):
def shell_quote (value):
"""Quote all shell metacharacters in given string value."""
return "'%s'" % value.replace("'", r"\'")
"""Quote all shell metacharacters in given string value with strong
(ie. single) quotes, handling the single quote especially."""
return "'%s'" % value.replace("'", r"'\''")
def stripext (filename):