Skip to content

Instantly share code, notes, and snippets.

@bnoordhuis
Created November 14, 2011 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bnoordhuis/1364050 to your computer and use it in GitHub Desktop.
Save bnoordhuis/1364050 to your computer and use it in GitHub Desktop.
diff --git a/src/unix/process.c b/src/unix/process.c
index c5a4592..59e1006 100644
--- a/src/unix/process.c
+++ b/src/unix/process.c
@@ -156,9 +156,14 @@ static int uv__process_init_pipe(uv_pipe_t* handle, int fds[2], int flags) {
return uv__make_pipe(fds, flags);
}
+#ifndef HAVE_VFORK
+# define HAVE_VFORK 1
+#endif
#ifndef SPAWN_WAIT_EXEC
-# define SPAWN_WAIT_EXEC 1
+# if !HAVE_VFORK
+# define SPAWN_WAIT_EXEC 1
+# endif
#endif
int uv_spawn(uv_loop_t* loop, uv_process_t* process,
@@ -224,7 +229,11 @@ int uv_spawn(uv_loop_t* loop, uv_process_t* process,
goto error;
#endif
+#if HAVE_VFORK
+ pid = vfork();
+#else
pid = fork();
+#endif
if (pid == -1) {
#if SPAWN_WAIT_EXEC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment