diff options
author | kmvanbrunt <kmvanbrunt@gmail.com> | 2018-04-06 12:31:42 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-06 12:31:42 -0400 |
commit | 8a0d3cfcfbac869e28827cc15fe59ed8ea42fa95 (patch) | |
tree | d0d2897d4fcc63b5a3613f3da42a7af8e99f2365 | |
parent | 4c9e18ceec716d83b574353739cf4837002ca396 (diff) | |
parent | 80da52f80ff86f3a7d88715931658811ca61b07a (diff) | |
download | cmd2-git-8a0d3cfcfbac869e28827cc15fe59ed8ea42fa95.tar.gz |
Merge pull request #337 from python-cmd2/shell_expansion
No longer expanding env vars since the shell will do that
-rwxr-xr-x | cmd2.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -3072,11 +3072,13 @@ Usage: Usage: unalias [-a] name [name ...] Usage: shell <command> [arguments]""" try: - tokens = shlex.split(command, posix=POSIX_SHLEX) + # Use non-POSIX parsing to keep the quotes around the tokens + tokens = shlex.split(command, posix=False) except ValueError as err: self.perror(err, traceback_war=False) return + # Support expanding ~ in quoted paths for index, _ in enumerate(tokens): if len(tokens[index]) > 0: # Check if the token is quoted. Since shlex.split() passed, there isn't @@ -3085,7 +3087,6 @@ Usage: Usage: unalias [-a] name [name ...] if first_char in QUOTES: tokens[index] = strip_quotes(tokens[index]) - tokens[index] = os.path.expandvars(tokens[index]) tokens[index] = os.path.expanduser(tokens[index]) # Restore the quotes |