Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aaronjensen/13daec7a96cdb5e903fd7e59da604de5 to your computer and use it in GitHub Desktop.
Save aaronjensen/13daec7a96cdb5e903fd7e59da604de5 to your computer and use it in GitHub Desktop.
From 4a9221e2332d85d64978719a43f884b92bf6cb7b Mon Sep 17 00:00:00 2001
From: Aaron Jensen <[email protected]>
Date: Sat, 8 Apr 2017 08:32:57 -0700
Subject: [PATCH 1/2] Enable vfork on macOS
---
src/conf_post.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/conf_post.h b/src/conf_post.h
index 209f60792c..04c5cd6cf6 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -87,8 +87,8 @@ typedef bool bool_bf;
(make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile
does not exist. Also, setsid is not allowed in the vfork child's
context as of Darwin 9/Mac OS X 10.5. */
-#undef HAVE_WORKING_VFORK
-#define vfork fork
+/* #undef HAVE_WORKING_VFORK */
+/* #define vfork fork */
#endif /* DARWIN_OS */
/* If HYBRID_MALLOC is defined (e.g., on Cygwin), emacs will use
--
2.12.2
From 9a15fda33bf2b369207701b66cd8f93e2d3a8801 Mon Sep 17 00:00:00 2001
From: Aaron Jensen <[email protected]>
Date: Sun, 9 Apr 2017 07:43:25 -0700
Subject: [PATCH 2/2] Only vfork if not pty
---
src/process.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/process.c b/src/process.c
index 7ab92b0102..b49d5970c8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1811,7 +1811,14 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
int volatile forkerr_volatile = forkerr;
struct Lisp_Process *p_volatile = p;
- pid = vfork ();
+ #ifdef DARWIN_OS
+ if (pty_flag)
+ pid = fork ();
+ else
+ pid = vfork ();
+ #else
+ pid = vfork ();
+ #endif
current_dir = current_dir_volatile;
lisp_pty_name = lisp_pty_name_volatile;
--
2.12.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment