Skip to content

Commit 1c2899b

Browse files
authored
Merge pull request #344 from adamgundry/wip/342-support-absent-fork
Support being configured without fork
2 parents f7d5138 + 5c98f59 commit 1c2899b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

cbits/posix/common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ char *find_executable(char *workingDirectory, char *filename);
3030
#endif
3131

3232
// defined in fork_exec.c
33+
#if defined(HAVE_FORK)
3334
ProcHandle
3435
do_spawn_fork (char *const args[],
3536
char *workingDirectory, char **environment,
@@ -39,6 +40,7 @@ do_spawn_fork (char *const args[],
3940
gid_t *childGroup, uid_t *childUser,
4041
int flags,
4142
char **failed_doing);
43+
#endif
4244

4345
// defined in posix_spawn.c
4446
ProcHandle

cbits/posix/runProcess.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#include "runProcess.h"
88
#include "common.h"
99

10-
#if defined(HAVE_FORK)
11-
1210
#include <unistd.h>
1311
#include <errno.h>
1412
#include <sys/wait.h>
@@ -70,13 +68,19 @@ do_spawn (char *const args[],
7068
return r;
7169
}
7270

71+
#if defined(HAVE_FORK)
7372
r = do_spawn_fork(args,
7473
workingDirectory, environment,
7574
stdInHdl, stdOutHdl, stdErrHdl,
7675
childGroup, childUser,
7776
flags,
7877
failed_doing);
7978
return r;
79+
#else
80+
*failed_doing = "fork";
81+
return -1;
82+
#endif
83+
8084
}
8185

8286
enum pipe_direction {
@@ -267,5 +271,3 @@ waitForProcess (ProcHandle handle, int *pret)
267271

268272
return -1;
269273
}
270-
271-
#endif // HAVE_FORK

0 commit comments

Comments
 (0)