Skip to content

Commit 6f8a6d6

Browse files
authored
Fix and use posix_spawn_file_actions_addchdir_np() check for Android (#113)
1 parent d67192d commit 6f8a6d6

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Sources/TSCclibc/process.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,24 @@
55
#include "process.h"
66

77
int SPM_posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *restrict file_actions, const char *restrict path) {
8-
#if __GLIBC_PREREQ(2, 29)
8+
#if defined(__GLIBC__)
9+
# if __GLIBC_PREREQ(2, 29)
910
return posix_spawn_file_actions_addchdir_np(file_actions, path);
11+
# else
12+
return ENOSYS;
13+
# endif
1014
#else
1115
return ENOSYS;
1216
#endif
1317
}
1418

1519
bool SPM_posix_spawn_file_actions_addchdir_np_supported() {
16-
#if __GLIBC_PREREQ(2, 29)
20+
#if defined(__GLIBC__)
21+
# if __GLIBC_PREREQ(2, 29)
1722
return true;
23+
# else
24+
return false;
25+
# endif
1826
#else
1927
return false;
2028
#endif

Tests/TSCBasicTests/ProcessTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ class ProcessTests: XCTestCase {
271271
return
272272
}
273273

274-
#if os(Linux)
274+
#if os(Linux) || os(Android)
275275
guard SPM_posix_spawn_file_actions_addchdir_np_supported() else {
276276
// Skip this test since it's not supported in this OS.
277277
return

0 commit comments

Comments
 (0)