Skip to content

Commit

Permalink
CreateProcess needs CREATE_UNICODE_ENVIRONMENT
Browse files Browse the repository at this point in the history
> If this flag is set, the environment block pointed to by
> lpEnvironment uses Unicode characters. Otherwise, the environment
> block uses ANSI characters.

[doc][]

This was forgotten from PR ocsigen#843 that switched to Unicode strings on
Windows (including the environment).

[doc]: https://docs.microsoft.com/en-us/windows/win32/procthread/process-creation-flags#CREATE_UNICODE_ENVIRONMENT
  • Loading branch information
MisterDA committed Nov 18, 2021
1 parent a6abacb commit 99468c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

* Code quality improvement: remove an uneeded Obj.magic (#844, Benoit Montagu).

* On Windows, use the Unicode API in C stubs and functions introduced in OCaml 4.06 to handle Unicode strings. Raise the minimum requirement to OCaml 4.06 (on Windows only). (#843, Antonin Décimo)
* On Windows, use the Unicode API in C stubs and functions introduced in OCaml 4.06 to handle Unicode strings. Raise the minimum requirement to OCaml 4.06 (on Windows only). (#843, #903, Antonin Décimo)

===== 5.4.2 =====

Expand Down
3 changes: 2 additions & 1 deletion src/unix/lwt_process_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ CAMLprim value lwt_process_create_process(value prog, value cmdline, value env,

STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD flags = CREATE_UNICODE_ENVIRONMENT;
BOOL ret;

#define string_option(opt) \
Expand All @@ -62,7 +63,7 @@ CAMLprim value lwt_process_create_process(value prog, value cmdline, value env,
si.hStdOutput = get_handle(Field(fds, 1));
si.hStdError = get_handle(Field(fds, 2));

ret = CreateProcess(progs, cmdlines, NULL, NULL, TRUE, 0,
ret = CreateProcess(progs, cmdlines, NULL, NULL, TRUE, flags,
envs, cwds, &si, &pi);
caml_stat_free(progs);
caml_stat_free(cmdlines);
Expand Down

0 comments on commit 99468c5

Please sign in to comment.