-
Notifications
You must be signed in to change notification settings - Fork 12
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
Issue #78 Fix handling of plain backslashes #77
base: master
Are you sure you want to change the base?
Conversation
Hey @scroix, I'm just looking into this issue. I think there might just be a bug in that One other possible complication to consider is how this is dished off to the sandbox process: I'm not sure if that's affected, but we do need to consider it because it has its own handling of args dictated by .NET (see src_process-sandbox.cs) , as opposed to Nodel with has process args dictated by Java. |
Hey @scroix, you've sent me down a little rabbit hole with this one. I think your proposal of the inverted commas might not necessarily solve all problems. (Ignore the actual bug related to escaping, issue #78.) I remember identifying this as an issue when I wrote the Sandbox process: When the sandbox runs and passes on the list of arguments, C#/.NET automatically strips any quotes away. This process tree shows exactly what's happening: nodel launches sanbox process and correctly encloses arg in quotes: ...\Temp\nodel-proc-sandbox-2.2.1-dev_r468.exe --ppid 17188 "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" "c:\content\Sample Video File For Testing.mp4" sandbox process launches vlc but it ends up not being in quotes: ...\vlc.exe" c:\content\Sample Video File For Testing.mp4 This trips up VLC because it treats it like 4 items in a playlist, i.e. Unfortunately this is because of the way .NET handles arguments in normal programs using as seems to strip quotes as a convenience to the programmer: static void Main(string[] args)
{ I believe a proper fix to this problem would be for the SandBox process to make use of the Environment.CommandLine instead of the class That's definitely doable but the argument parser code needs to be restructured - see line 129 in src_process-sandbox.cs. I'm happy to look into this but can't do it for at least a week. |
Thank you for all your efforts investigating.
It's very minor, no rush, add it to the backlog. 📃 I've come up with a work around which I'd recommend to others. I realised in the case of VLC I could actually just change the working directory to avoid the use of backslashes (in the app. args) all-together. e.g. |
…b.com/museumsvictoria/nodel-recipes into app_launcher/plain-backslash-handling
- Adds backslash to current arg when escaping - Simplifies space and quote handling - Clears current arg after appending to list
I've returned to this issue after your explanation (@justparking) cleared things up for me. This PR now focuses just on addressing the issue with decodArgList not handling back slashes. This is also described in #78 |
I've noticed that escaping behaves a little unexpectedly for example with the following parameters, I get two different results.
👇
👇
Full command-line: [C:\Program Files\VideoLAN\VLC\vlc.exe C:contentMLK.mp4]
(notice the AppArgs have been sanitised)The behaviour on, for example, PowerShell is that auto completion uses apostrophes to protect strings.
This PR suggests adding the same special case such that I'm able to retain backslashes in my App. Args if I enclose them in apostrophes I retain the string as it is typed into the parameter.
👇
👇
Full command-line: [C:\Program Files\VideoLAN\VLC\vlc.exe 'C:\content\MLK.mp4']