Skip to content

Commit 99f11a8

Browse files
committed
Call posix_spawnp through a wrapper functions, since the nullability changed in incompatible ways between Android NDK r27 and r28
This will allow the package to build with both r27 and r28, the former of which is currently the default on swiftlang's GitHub Actions CI.
1 parent 847c107 commit 99f11a8

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Sources/TSCBasic/Process/Process.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ public final class Process {
742742
}
743743
let argv = CStringArray(resolvedArgs)
744744
let env = CStringArray(environment.map({ "\($0.0)=\($0.1)" }))
745-
let rv = posix_spawnp(&processID, argv.cArray[0]!, &fileActions, &attributes, argv.cArray, env.cArray)
745+
let rv = SPM_posix_spawnp(&processID, argv.cArray[0]!, &fileActions, &attributes, argv.cArray, env.cArray)
746746

747747
guard rv == 0 else {
748748
throw SystemError.posix_spawn(rv, arguments)

Sources/TSCclibc/include/process.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ int SPM_posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *restric
1818
// Runtime check for the availability of posix_spawn_file_actions_addchdir_np. Returns 0 if the method is available, -1 if not.
1919
bool SPM_posix_spawn_file_actions_addchdir_np_supported();
2020

21+
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[]);
22+
2123
#ifdef TSC_API_UNAVAILABLE_DEFINED
2224
#undef TSC_API_UNAVAILABLE_DEFINED
2325
#undef __API_UNAVAILABLE

Sources/TSCclibc/process.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,8 @@ bool SPM_posix_spawn_file_actions_addchdir_np_supported() {
5252
#endif
5353
}
5454

55+
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[]) {
56+
return posix_spawnp(pid, file, actions, attr, argv, env);
57+
}
58+
5559
#endif

0 commit comments

Comments
 (0)