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

passing env in Lwt_process doesn't work on Windows #966

Open
mroch opened this issue Oct 19, 2022 · 1 comment · May be fixed by #967
Open

passing env in Lwt_process doesn't work on Windows #966

mroch opened this issue Oct 19, 2022 · 1 comment · May be fixed by #967

Comments

@mroch
Copy link

mroch commented Oct 19, 2022

#define string_option(opt) \
(Is_block(opt) ? caml_stat_strdup_to_os(String_val(Field(opt, 0))) : NULL)
char_os
*progs = string_option(prog),
*cmdlines = caml_stat_strdup_to_os(String_val(cmdline)),
*envs = string_option(env),

An "environment block" consists of a null-terminated block of null-terminated strings. Using caml_stat_strdup_to_os doesn't work because it only supports null-terminated strings -- it stops on the first \0 and misses the rest of the block.

ocaml itself deals with this here:

https://github.com/ocaml/ocaml/blob/000d15d4e229e895612177590df08d0364b1cb04/otherlibs/unix/createprocess.c#L122-L127

but an external library like Lwt can't do the same thing. see ocaml/ocaml#11449 re: adding a public API.

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 a pull request may close this issue.

1 participant