Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eecc0b9

Browse files
committed
Patch for an Issue #1148
1 parent 2af2aef commit eecc0b9

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lib/parse/cmdline.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,16 @@ def _(self, *args):
788788
prompt = False
789789
advancedHelp = True
790790

791-
for arg in (sys.argv if not IS_WIN else shlex.split(" ".join(sys.argv))):
791+
_ = sys.argv
792+
793+
# Python on Windows has problems with quote/whitespace cases like: python -c "import sys; print sys.argv" --dummy='foo: bar' # ['-c', "--dummy='foo:", "bar'"]
794+
if IS_WIN:
795+
try:
796+
_ = shlex.split(" ".join(sys.argv), posix=False)
797+
except ValueError:
798+
pass
799+
800+
for arg in _:
792801
argv.append(getUnicode(arg, encoding=sys.getfilesystemencoding()))
793802

794803
checkDeprecatedOptions(argv)

0 commit comments

Comments
 (0)