diff options
| author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-23 22:31:15 -0400 |
|---|---|---|
| committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-07-23 22:31:15 -0400 |
| commit | 5ef4e2018fe854045a366afec5f10682c1438cf2 (patch) | |
| tree | ebabbacd91d751a76e18d285a86431a34027fbf7 /cmd2/cmd2.py | |
| parent | 32b9ddd62915d913037c9c6df6c3ac78c3d15858 (diff) | |
| download | cmd2-git-5ef4e2018fe854045a366afec5f10682c1438cf2.tar.gz | |
Fixed quoting issue
Diffstat (limited to 'cmd2/cmd2.py')
| -rw-r--r-- | cmd2/cmd2.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 63d3b958..79e7aad8 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -3248,8 +3248,8 @@ class Cmd(cmd.Cmd): # This is a hidden flag for telling do_py to run a pyscript. It is intended only to be used by run_pyscript # after it sets up sys.argv for the script being run. When this flag is present, it takes precedence over all - # other arguments. run_pyscript uses this method instead of "py run('file')" because file names with spaces cause - # issues with our parser, which isn't meant to parse Python statements. + # other arguments. run_pyscript uses this method instead of "py run('file')" because file names with + # 2 or more consecutive spaces cause issues with our parser, which isn't meant to parse Python statements. py_parser.add_argument('--pyscript', help=argparse.SUPPRESS) # Preserve quotes since we are passing these strings to Python @@ -3270,6 +3270,10 @@ class Cmd(cmd.Cmd): # Handle case where we were called by run_pyscript if args.pyscript: + args.pyscript = utils.strip_quotes(args.pyscript) + + # Run the script - use repr formatting to escape things which + # need to be escaped to prevent issues on Windows py_code_to_run = 'run({!r})'.format(args.pyscript) elif args.command: |
