File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -3072,11 +3072,13 @@ def do_shell(self, command):
3072
3072
Usage: shell <command> [arguments]"""
3073
3073
3074
3074
try :
3075
- tokens = shlex .split (command , posix = POSIX_SHLEX )
3075
+ # Use non-POSIX parsing to keep the quotes around the tokens
3076
+ tokens = shlex .split (command , posix = False )
3076
3077
except ValueError as err :
3077
3078
self .perror (err , traceback_war = False )
3078
3079
return
3079
3080
3081
+ # Support expanding ~ in quoted paths
3080
3082
for index , _ in enumerate (tokens ):
3081
3083
if len (tokens [index ]) > 0 :
3082
3084
# Check if the token is quoted. Since shlex.split() passed, there isn't
@@ -3085,7 +3087,6 @@ def do_shell(self, command):
3085
3087
if first_char in QUOTES :
3086
3088
tokens [index ] = strip_quotes (tokens [index ])
3087
3089
3088
- tokens [index ] = os .path .expandvars (tokens [index ])
3089
3090
tokens [index ] = os .path .expanduser (tokens [index ])
3090
3091
3091
3092
# Restore the quotes
You can’t perform that action at this time.
0 commit comments