Skip to content

Commit

Permalink
Merge pull request #903 from MisterDA/windows-create-process-unicode-env
Browse files Browse the repository at this point in the history
 `CreateProcess` needs `CREATE_UNICODE_ENVIRONMENT`
  • Loading branch information
smorimoto authored Nov 23, 2021
2 parents 0ebeccb + a9d7cfe commit d5f8452
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,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
3 changes: 2 additions & 1 deletion src/unix/windows_c/windows_system_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ CAMLprim value lwt_unix_system_job(value cmdline)
CAMLparam1(cmdline);
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD flags = CREATE_UNICODE_ENVIRONMENT;
BOOL ret;

char_os *cmdlines = caml_stat_strdup_to_os(String_val(cmdline));
Expand All @@ -59,7 +60,7 @@ CAMLprim value lwt_unix_system_job(value cmdline)
ZeroMemory(&pi, sizeof(pi));
si.cb = sizeof(si);

ret = CreateProcess(NULL, cmdlines, NULL, NULL, TRUE, 0,
ret = CreateProcess(NULL, cmdlines, NULL, NULL, TRUE, flags,
NULL, NULL, &si, &pi);
caml_stat_free(cmdlines);
if (!ret) {
Expand Down

0 comments on commit d5f8452

Please sign in to comment.