summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'process.c')
-rw-r--r--process.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/process.c b/process.c
index 0d16bb6e43..c7be7286e1 100644
--- a/process.c
+++ b/process.c
@@ -1330,7 +1330,14 @@ rb_f_fork(obj)
fflush(stderr);
#endif
- switch (pid = fork()) {
+#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
+ before_exec();
+#endif
+ pid = fork();
+#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
+ after_exec();
+#endif
+ switch (pid) {
case 0:
#ifdef linux
after_exec();
@@ -1570,6 +1577,9 @@ rb_f_system(argc, argv)
chfunc = signal(SIGCHLD, SIG_DFL);
retry:
+#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
+ before_exec();
+#endif
pid = fork();
if (pid == 0) {
/* child process */
@@ -1577,6 +1587,9 @@ rb_f_system(argc, argv)
rb_protect(proc_exec_args, (VALUE)&earg, NULL);
_exit(127);
}
+#if defined(__NetBSD__) || defined(__APPLE__) || defined(linux)
+ after_exec();
+#endif
if (pid < 0) {
if (errno == EAGAIN) {
rb_thread_sleep(1);