mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 16:34:47 +01:00
Fixed escape_windows_cmd_string
not handling ^ correctly
This commit is contained in:
parent
5cb3e8dd55
commit
876740b535
3 changed files with 15 additions and 3 deletions
13
news/win_escape.rst
Normal file
13
news/win_escape.rst
Normal file
|
@ -0,0 +1,13 @@
|
|||
**Added:** None
|
||||
|
||||
**Changed:** None
|
||||
|
||||
**Deprecated:** None
|
||||
|
||||
**Removed:** None
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* Fixed a problem with escaping charet (^) character for cmd.exe in the source-cmd function.
|
||||
|
||||
**Security:** None
|
|
@ -1070,7 +1070,7 @@ def test_dynamic_cwd_tuple_to_str(inp, exp):
|
|||
('foo&bar', 'foo^&bar'),
|
||||
('foo$?-/_"\\', 'foo$?-/_^"\\'),
|
||||
('^&<>|', '^^^&^<^>^|'),
|
||||
('this /?', 'this /.')
|
||||
('()<>','^(^)^<^>'),
|
||||
])
|
||||
def test_escape_windows_cmd_string(st, esc):
|
||||
obs = escape_windows_cmd_string(st)
|
||||
|
|
|
@ -890,9 +890,8 @@ def escape_windows_cmd_string(s):
|
|||
The escaping is based on details here and empirical testing:
|
||||
http://www.robvanderwoude.com/escapechars.php
|
||||
"""
|
||||
for c in '()%!^<>&|"':
|
||||
for c in '^()%!<>&|"':
|
||||
s = s.replace(c, '^' + c)
|
||||
s = s.replace('/?', '/.')
|
||||
return s
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue