From abc1395427331029af0c1ec80a6a1f820b752e00 Mon Sep 17 00:00:00 2001 From: Sylvain78 Date: Sun, 7 Apr 2024 21:15:49 +0000 Subject: [PATCH] haiku --- otherlibs/stdune/src/proc.ml | 4 +++- vendor/opam/src/core/custom_opamStubs.c | 12 ++++++------ vendor/spawn/src/spawn_stubs.c | 1 - 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/otherlibs/stdune/src/proc.ml b/otherlibs/stdune/src/proc.ml index c207ce0d81a..fe7e4bc66d5 100644 --- a/otherlibs/stdune/src/proc.ml +++ b/otherlibs/stdune/src/proc.ml @@ -11,7 +11,9 @@ let restore_cwd_and_execve prog argv ~env = (* run at_exit before changing the working directory *) Stdlib.do_at_exit (); Sys.chdir (Path.External.to_string Path.External.initial_cwd); - if Sys.win32 + let os_haiku = Sys.os_type == "BeOS" || (try ignore(Sys.getenv "BE_HOST_CPU");true with Not_found -> false) + in + if Sys.win32 || os_haiku then ( let pid = Unix.create_process_env prog argv env Unix.stdin Unix.stdout Unix.stderr in match snd (Unix.waitpid [] pid) with diff --git a/vendor/opam/src/core/custom_opamStubs.c b/vendor/opam/src/core/custom_opamStubs.c index e459dcefb56..174c2d9da67 100644 --- a/vendor/opam/src/core/custom_opamStubs.c +++ b/vendor/opam/src/core/custom_opamStubs.c @@ -80,20 +80,20 @@ CAMLprim value OPAMW_GetArchitecture(value unit) #else -static char * unavailable_message = - "Windows stubs are only allowed to be called on Windows."; +static void fail () +{ + caml_failwith("Windows stubs are only allowed to be called on Windows."); +} CAMLprim value OPAMW_GetWindowsVersion(value unit) { - (void)unit; - caml_failwith(unavailable_message); + fail (); } CAMLprim value OPAMW_GetArchitecture(value unit) { - (void)unit; - caml_failwith(unavailable_message); + fail (); } #endif diff --git a/vendor/spawn/src/spawn_stubs.c b/vendor/spawn/src/spawn_stubs.c index ac3f3d4dffa..90182e3c627 100644 --- a/vendor/spawn/src/spawn_stubs.c +++ b/vendor/spawn/src/spawn_stubs.c @@ -344,7 +344,6 @@ static void subprocess(int failure_fd, struct spawn_info *info) } pthread_sigmask(SIG_SETMASK, &info->child_sigmask, NULL); - execve(info->prog, info->argv, info->env); subprocess_failure(failure_fd, "execve", PROG); }