lwt
lwt copied to clipboard
passing `env` in `Lwt_process` doesn't work on Windows
https://github.com/ocsigen/lwt/blob/32042007d3051345bb98618e1a2a97b279800f27/src/unix/lwt_process_stubs.c#L91-L97
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 https://github.com/ocaml/ocaml/issues/11449 re: adding a public API.
here is a test demonstrating the issue: https://github.com/mroch/lwt/commit/014d18c952c722d1489ce5a5fbc0bf5fd15e2cc7