Skip to content

Commit a62d1c3

Browse files
committed
Add some systems that support addchdir.
1 parent 9a737d1 commit a62d1c3

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/core/os.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,17 @@ extern char **environ;
7676

7777
/* Detect availability of posix_spawn_file_actions_addchdir_np. Since
7878
* this doesn't seem to follow any standard, just a common extension, we
79-
* must enumerate supported systems for availability. */
79+
* must enumerate supported systems for availability. Define JANET_SPAWN_NO_CHDIR
80+
* to disable this. */
81+
#ifndef JANET_SPAWN_NO_CHDIR
8082
#ifdef __GLIBC__
8183
#define JANET_SPAWN_CHDIR
84+
#elif defined(JANET_APPLE) /* Some older versions may not work here. */
85+
#define JANET_SPAWN_CHDIR
86+
#elif defined(__FreeBSD__) /* Not all BSDs work, for example openBSD doesn't seem to support this */
87+
#define JANET_SPAWN_CHDIR
88+
#endif
8289
#endif
83-
8490

8591
/* Not POSIX, but all Unixes but Solaris have this function. */
8692
#if defined(JANET_POSIX) && !defined(__sun)

0 commit comments

Comments
 (0)