ocaml / ocamlbuild

The legacy OCamlbuild build manager
Other
121 stars 81 forks source link

No longer call into cmd.exe to execute a posix shell on windows #339

Closed hhugo closed 2 months ago

hhugo commented 2 months ago

based on top of #338 Inspired by #330. Sys.command, Unix.open_process_in, Unix.open_process_full all go through cmd.exe to execute the given command. In our case, it means we call cmd.exe to call bash. This is unnecessary, and complicate things. We can directly call a posix shell and not have to worry about another layer of escaping.

In this PR, we use open_process_args* funtions to avoid going through cmd.exe

hhugo commented 2 months ago

There was some logic elsewhere to read the PATH (that was not handling quoted path). I've unified things in https://github.com/ocaml/ocamlbuild/pull/339/commits/d834dd075fd257037d9e919a7d1172034c2b9990