Fix Filename.quote_command hanlding of forward slashes in program path under Win32#13417
Fix Filename.quote_command hanlding of forward slashes in program path under Win32#13417nojb merged 7 commits intoocaml:trunkfrom
Filename.quote_command hanlding of forward slashes in program path under Win32#13417Conversation
|
(The CI failure is unrelated.) |
|
For cmd, I think we still have some fairly tight limits on command length to worry about - might it be better to convert forward slashes to backslashes instead? |
Yes. Also, this quoting solution may not work in all cases, see the discussion at ocaml/dune#10869. I will revise the patch. |
I did this. Do you mind taking a look? Thanks! |
damiendoligez
left a comment
There was a problem hiding this comment.
Looks good. I have a small suggestion to simplify the test.
| if not (Sys.file_exists "sub") then Sys.mkdir "sub" 0o777; | ||
| copy_file "myecho.exe" "sub/myecho.exe"; | ||
| printf "-------- Forward slashes in program position\n"; | ||
| run "sub/myecho.exe" ["alea iacta est"] |
There was a problem hiding this comment.
You could simplify like this:
| if not (Sys.file_exists "sub") then Sys.mkdir "sub" 0o777; | |
| copy_file "myecho.exe" "sub/myecho.exe"; | |
| printf "-------- Forward slashes in program position\n"; | |
| run "sub/myecho.exe" ["alea iacta est"] | |
| printf "-------- Forward slashes in program position\n"; | |
| run "./myecho.exe" ["alea iacta est"] |
There was a problem hiding this comment.
Suggestion applied. Thanks @damiendoligez!
|
Cherry-picked to 5.3: 8a1ba11 |
Fixes #13415
Tweak the code to quote the program path if it contains a forward slash.