Skip to content
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

Windows [find_executable] fixes #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jonahbeckford
Copy link

  • Use ';' as PATH seperator on Windows.

  • On Windows Sys.file_exists can return true even if Sys.is_directory is true. And an executable ends in .exe

Before

utop # eval (find_executable_exn "git") ;;
Exception: Failure "command \"git\" not found".
Raised at Stdlib.failwith in file "stdlib.ml", line 29, characters 17-33
Called from Shexp_process__Process.map.(fun) in file "process-lib/src/process.ml", line 533, characters 40-45
Called from Shexp_process__Process.exec in file "process-lib/src/process.ml", line 173, characters 12-47
Re-raised at Shexp_process__Process.exec in file "process-lib/src/process.ml", line 176, characters 8-19
Called from Stdlib__Fun.protect in file "fun.ml", line 33, characters 8-15
Re-raised at Stdlib__Fun.protect in file "fun.ml", line 38, characters 6-52
Called from Topeval.load_lambda in file "toplevel/byte/topeval.ml", line 89, characters 4-153

And it has the same exception for git.exe.

After

utop # let open Shexp_process in eval (find_executable "git" ) ;;
- : string option = Some "C:\\Program Files\\Git\\cmd\\git.exe"

utop # let open Shexp_process in eval (find_executable "git.exe" ) ;;
- : string option = Some "C:\\Program Files\\Git\\cmd\\git.exe"

+ Use ';' as PATH seperator on Windows.

+ On Windows Sys.file_exists can return true even if Sys.is_directory is true. And an executable ends in `.exe`

Signed-off-by: Jonah Beckford <[email protected]>
@github-iron github-iron added the forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system. label Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
forwarded-to-js-devs This report has been forwarded to Jane Street's internal review system.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants