-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash when single dash ("-") arg is supplied to IINA via cmd line #4032
Conversation
Thanks for taking this one! Pulled PR locally and verified that piping to However the code is still a bit messed up as can be seen by these log messages: low-batt@gag MacOS$ cat ~/Movies/resume-failure.mp4 | ./iina-cli -
…
14:09:57.567 [iina][d] Got arguments ["--stdin", "-"]
14:09:57.567 [iina][d] IINA arguments: ["--stdin"]
14:09:57.567 [iina][d] Filenames from arguments: [] So Then IINA instead of translating "-" into "--stdin" or "/dev/stdin" just ignores the "-"? Because of what Thoughts? |
I think there are two separate points here.
|
I believe in unix it is up to commands as to how they want to interpret "-", so yes, it does not always mean read from stdin. For IINA we always want to match up with mpv unless we have a good reason to deviate. From the mpv manual, section usage:
I don't see a reason for IINA to not match up with mpv in this case. I didn't request changes as the PR fixes a crash and supports reading from stdin like the user requested. Just wanted to hear your thoughts on this aspect of the behavior. We can definitely treat this as a separate issue. There are definitely other issues in regard to CLI behavior. |
…, and add checks to deduplicate occurrences of it
7013856
to
8241070
Compare
OK, I dug deeper into it, and you are right. I pushed an updated version which should handle the single dash correctly, and also should handle Seems like it would be easier & less error prone to just use a stricter form of parsing which requires that all non-file arguments are in the form "--key=value", and anything that doesn't start with dashes is an input file. And especially since mpv has indicates that's where they are trying to go in the future. But this isn't really a feature I use anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pulled PR, built and confirmed running IINA like this works now and does not crash:
low-batt@gag MacOS$ cat ~/Movies/resume-failure.mp4 | ./iina-cli -
Thanks! |
Description:
Adds a simple check to avoid a fatal error at startup, if a single dash (
-
) is included in the args.It was easy to confirm the crash, and also confirm the fix, by just supplying an arg in XCode's Scheme Editor: