Parameter parsing bug on Windows
See original GitHub issueThe parameter parser doesn’t handle escaped characters correctly on Windows.
Running this works on Linux/MacOS, but fails on Windows:
streamlink -p /path/to/vlc -a "--input-title-format \"\\\"\" {filename}" STREAM best
This is related to chrippa/livestreamer#1337 (reported at streamlink/streamlink-twitch-gui#256 and streamlink/streamlink-twitch-gui#362)
I can’t remember if Linux/MacOS were affected by this in Livestreamer. Didn’t test it…
The error log:
[cli][info] Starting player: C:/Program Files (x86)/VideoLAN/VLC/vlc.exe
Traceback (most recent call last):
File "C:\Program Files (x86)\Streamlink\bin\streamlink-script.py", line 12, in <module>
main()
File "C:\Program Files (x86)\Streamlink\pkgs\streamlink_cli\main.py", line 899, in main
handle_url()
File "C:\Program Files (x86)\Streamlink\pkgs\streamlink_cli\main.py", line 499, in handle_url
handle_stream(plugin, streams, stream_name)
File "C:\Program Files (x86)\Streamlink\pkgs\streamlink_cli\main.py", line 382, in handle_stream
success = output_stream(stream)
File "C:\Program Files (x86)\Streamlink\pkgs\streamlink_cli\main.py", line 259, in output_stream
output.open()
File "C:\Program Files (x86)\Streamlink\pkgs\streamlink_cli\output.py", line 21, in open
self._open()
File "C:\Program Files (x86)\Streamlink\pkgs\streamlink_cli\output.py", line 123, in _open
self._open_subprocess()
File "C:\Program Files (x86)\Streamlink\pkgs\streamlink_cli\output.py", line 138, in _open_subprocess
self.player = subprocess.Popen(self._create_arguments(),
File "C:\Program Files (x86)\Streamlink\pkgs\streamlink_cli\output.py", line 116, in _create_arguments
return shlex.split(cmd) + shlex.split(args)
File "shlex.py", line 273, in split
File "shlex.py", line 263, in __next__
File "shlex.py", line 90, in get_token
File "shlex.py", line 166, in read_token
ValueError: No closing quotation
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
The command line parsing may erroneously parse ... - GitHub
Looking at the use of Windows Terminal, I speculate that this problem is caused by an error in parsing the command line. If...
Read more >Parsing error when using variable as parameter value for ...
I'm using the following template: #TemplateWithParams.yaml parameters: - name: DatabaseServer type: string - name: InstanceId type: string steps: - script: ...
Read more >How Command Line Parameters Are Parsed - David Deley
On Windows, the parameters are parsed off the command line after the new process is created, by the new process. It's considered the...
Read more >Windows Bat file optional argument parsing - Stack Overflow
This solution provides Unix style arguments within a Windows batch. ... The parsing loop always looks for an option at %1 , and...
Read more >ReportViewer bug: NullReference exception parsing null date ...
There appears to be a regression in recent datetime parsing changes to the Windows Forms Report Viewer control in NuGet package Microsoft.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Right. As far as
shlex
is concerned this is the correct behaviour as it implements strict POSIX. From the IEEE Std 1003.1-2008, specifically section 2.2.2.In fact, you can reproduce it in
sh
,bash
,zsh
, plus any other POSIX compatible shell; you will find that there is still an open quote on the second line:So the correct thing to do is to always use
"
😃I have added a test that reproduces this bug, and the most basic reproduction is:
Wether or not it can be easily fixed remains to be seen, as I workaround I would suggest always using
"
😃 I will dig a bit deeper and see if a bug needs to be filed against the Python stdlibs.