@@ -2892,6 +2892,7 @@ def do_set(self, args: argparse.Namespace) -> None:
28922892 help = 'arguments to pass to command' ),
28932893 ACTION_ARG_CHOICES , ('path_complete' ,))
28942894
2895+ # Preserve quotes since we are passing these strings to the shell
28952896 @with_argparser (shell_parser , preserve_quotes = True )
28962897 def do_shell (self , args : argparse .Namespace ) -> None :
28972898 """Execute a command as if at the OS prompt"""
@@ -2947,7 +2948,8 @@ def _reset_py_display() -> None:
29472948 py_parser .add_argument ('command' , help = "command to run" , nargs = '?' )
29482949 py_parser .add_argument ('remainder' , help = "remainder of command" , nargs = argparse .REMAINDER )
29492950
2950- @with_argparser (py_parser )
2951+ # Preserve quotes since we are passing these strings to Python
2952+ @with_argparser (py_parser , preserve_quotes = True )
29512953 def do_py (self , args : argparse .Namespace ) -> bool :
29522954 """Invoke Python command or shell"""
29532955 from .pyscript_bridge import PyscriptBridge , CommandResult
@@ -2987,9 +2989,9 @@ def run(filename: str):
29872989 interp .runcode ('import sys, os;sys.path.insert(0, os.getcwd())' )
29882990
29892991 if args .command :
2990- full_command = utils . quote_string_if_needed ( args .command )
2991- for cur_token in args .remainder :
2992- full_command += ' ' + utils . quote_string_if_needed ( cur_token )
2992+ full_command = args .command
2993+ if args .remainder :
2994+ full_command += ' ' + ' ' . join ( args . remainder )
29932995
29942996 interp .runcode (full_command )
29952997
0 commit comments