diff --git a/Sources/TSCBasic/Process/Process.swift b/Sources/TSCBasic/Process/Process.swift index bd946b88..2d0c8d72 100644 --- a/Sources/TSCBasic/Process/Process.swift +++ b/Sources/TSCBasic/Process/Process.swift @@ -742,7 +742,7 @@ public final class Process { } let argv = CStringArray(resolvedArgs) let env = CStringArray(environment.map({ "\($0.0)=\($0.1)" })) - let rv = posix_spawnp(&processID, argv.cArray[0]!, &fileActions, &attributes, argv.cArray, env.cArray) + let rv = SPM_posix_spawnp(&processID, argv.cArray[0]!, &fileActions, &attributes, argv.cArray, env.cArray) guard rv == 0 else { throw SystemError.posix_spawn(rv, arguments) diff --git a/Sources/TSCclibc/include/process.h b/Sources/TSCclibc/include/process.h index 08c57f37..2b9960ec 100644 --- a/Sources/TSCclibc/include/process.h +++ b/Sources/TSCclibc/include/process.h @@ -18,6 +18,8 @@ int SPM_posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *restric // Runtime check for the availability of posix_spawn_file_actions_addchdir_np. Returns 0 if the method is available, -1 if not. bool SPM_posix_spawn_file_actions_addchdir_np_supported(); +int SPM_posix_spawnp(pid_t *pid, const char *file, const posix_spawn_file_actions_t *actions, const posix_spawnattr_t *attr, char *const argv[], char *const env[]); + #ifdef TSC_API_UNAVAILABLE_DEFINED #undef TSC_API_UNAVAILABLE_DEFINED #undef __API_UNAVAILABLE diff --git a/Sources/TSCclibc/process.c b/Sources/TSCclibc/process.c index d6ac2a06..03c94015 100644 --- a/Sources/TSCclibc/process.c +++ b/Sources/TSCclibc/process.c @@ -52,4 +52,8 @@ bool SPM_posix_spawn_file_actions_addchdir_np_supported() { #endif } +int SPM_posix_spawnp(pid_t *pid, const char *file, const posix_spawn_file_actions_t *actions, const posix_spawnattr_t *attr, char *const argv[], char *const env[]) { + return posix_spawnp(pid, file, actions, attr, argv, env); +} + #endif