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):
30723072 Usage: shell <command> [arguments]"""
30733073
30743074 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 )
30763077 except ValueError as err :
30773078 self .perror (err , traceback_war = False )
30783079 return
30793080
3081+ # Support expanding ~ in quoted paths
30803082 for index , _ in enumerate (tokens ):
30813083 if len (tokens [index ]) > 0 :
30823084 # Check if the token is quoted. Since shlex.split() passed, there isn't
@@ -3085,7 +3087,6 @@ def do_shell(self, command):
30853087 if first_char in QUOTES :
30863088 tokens [index ] = strip_quotes (tokens [index ])
30873089
3088- tokens [index ] = os .path .expandvars (tokens [index ])
30893090 tokens [index ] = os .path .expanduser (tokens [index ])
30903091
30913092 # Restore the quotes
You can’t perform that action at this time.
0 commit comments