summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/unix/fork.c')
-rw-r--r--otherlibs/unix/fork.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/otherlibs/unix/fork.c b/otherlibs/unix/fork.c
index 428137dcb..74ec6294d 100644
--- a/otherlibs/unix/fork.c
+++ b/otherlibs/unix/fork.c
@@ -14,6 +14,7 @@
/* $Id$ */
#include <mlvalues.h>
+#include <debugger.h>
#include "unixsupport.h"
CAMLprim value unix_fork(value unit)
@@ -21,5 +22,9 @@ CAMLprim value unix_fork(value unit)
int ret;
ret = fork();
if (ret == -1) uerror("fork", Nothing);
+ if (caml_debugger_in_use)
+ if ((caml_debugger_fork_mode && ret == 0) ||
+ (!caml_debugger_fork_mode && ret != 0))
+ caml_debugger_cleanup_fork();
return Val_int(ret);
}