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

--ocamlenv: fix for Windows, cannot use exec #3627

Merged
merged 2 commits into from
Dec 7, 2024

Conversation

mtzguido
Copy link
Member

@mtzguido mtzguido commented Dec 6, 2024

OCaml's Unix module exposes an execv family of functions, which "seem" to work
correctly on Windows, but have a critical discrepancy: the new process
is not really replacing the current one, but instead being executed on
the side, and the parent process will not even wait for the spawned
process. This usually wreaks havoc.

This PR replaces our use of execv by Unix.create_process + Unix.waitpid,
both of which seem to work correctly on Windows too.

See https://lacamb.re/blog/windows_ocaml_execvp.html

Thanks @tahina-pro for figuring this out.

OCaml's Unix module exposes an execv family of functions, which "seem" to work
correctly on Windows, but have a critical discrepancy: the new process
is not really replacing the current one, but instead being executed on
the side, and the parent process will *not even wait* for the spawned
process. This usually wreaks havoc.

This PR replaces our use of execv by Unix.create_process + Unix.waitpid,
both of which seem to work correctly on Windows too.

See https://lacamb.re/blog/windows_ocaml_execvp.html

Thanks @tahina-pro for figuring this out.
@mtzguido
Copy link
Member Author

mtzguido commented Dec 6, 2024

@tahina-pro tahina-pro merged commit 0c5622b into FStarLang:master Dec 7, 2024
4 checks passed
@mtzguido mtzguido deleted the exec branch December 7, 2024 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants