changeset 16657:c1d5bf2eb3b6

go back to fork and setsid, but not on OS X systems * octave-gui.cc (dissociate_terminal): Use fork and setsid.
author John W. Eaton <jwe@octave.org>
date Tue, 14 May 2013 02:49:07 -0400
parents cf84ea2ba2d3
children 591cb51c18a3
files libgui/src/octave-gui.cc
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/octave-gui.cc	Mon May 13 18:50:14 2013 -0400
+++ b/libgui/src/octave-gui.cc	Tue May 14 02:49:07 2013 -0400
@@ -29,6 +29,7 @@
 
 #include <iostream>
 
+#include <unistd.h>
 #include <fcntl.h>
 
 #if defined (HAVE_SYS_IOCTL_H)
@@ -49,12 +50,7 @@
 static void
 dissociate_terminal (void)
 {
-#if ! defined (__WIN32__) || defined (__CYGWIN__)
-# if defined (HAVE_SYS_IOCTL_H) && defined (TIOCNOTTY)
-
-  ioctl (0, TIOCNOTTY);
-
-# else
+#if ! (defined (__WIN32__) || defined (__APPLE__)) || defined (__CYGWIN__)
  
   pid_t pid = fork ();
 
@@ -77,6 +73,9 @@
     {
       // Parent
 
+      // FIXME -- we should catch signals and pass them on to the child
+      // process in some way, possibly translating SIGINT to SIGTERM.
+
       int status;
 
       waitpid (pid, &status, 0);
@@ -85,7 +84,6 @@
             ? octave_wait::exitstatus (status) : 127);
     }
 
-# endif
 #endif
 }