Skip to content

Commit

Permalink
Fix syntax for Python 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Feb 28, 2020
1 parent aff0c88 commit 8860870
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ def _sh_quote(s):
r"""Given bl"a, returns "bl\\"a".
"""
if not s or any(c not in safe_shell_chars for c in s):
return b'"%s"' % (s.replace(b'\\', b'\\\\')
.replace(b'"', b'\\"')
.replace(b'`', b'\\`')
.replace(b'$', b'\\$'))
return (
b'"' +
s.replace(b'\\', b'\\\\')
.replace(b'"', b'\\"')
.replace(b'`', b'\\`')
.replace(b'$', b'\\$') +
b'"'
)
else:
return s

Expand Down

0 comments on commit 8860870

Please sign in to comment.