changeset 16597:49832f60282e

if available, use ioctl to give up controlling terminal * octave-gui.cc (dissociate_terminal): If sys/ioctl.h is available and TIOCNOTTY is defined, use ioctl to give up controlling terminal on Unixy systems.
author Ben Abbott <bpabbott@mac.com>
date Wed, 01 May 2013 02:02:21 -0400
parents 645672f1c873
children e84b77df8940
files libgui/src/octave-gui.cc
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/octave-gui.cc	Tue Apr 30 14:32:16 2013 -0400
+++ b/libgui/src/octave-gui.cc	Wed May 01 02:02:21 2013 -0400
@@ -29,6 +29,12 @@
 
 #include <iostream>
 
+#include <fcntl.h>
+
+#if defined (HAVE_SYS_IOCTL_H)
+#include <sys/ioctl.h>
+#endif
+
 #include "lo-utils.h"
 #include "oct-env.h"
 #include "syswait.h"
@@ -44,7 +50,12 @@
 dissociate_terminal (void)
 {
 #if ! defined (Q_OS_WIN32) || defined (Q_OS_CYGWIN)
+# if defined (HAVE_SYS_IOCTL_H) && defined (TIOCNOTTY)
 
+  ioctl (0, TIOCNOTTY);
+
+# else
+ 
   pid_t pid = fork ();
 
   if (pid < 0)
@@ -74,6 +85,7 @@
             ? octave_wait::exitstatus (status) : 127);
     }
 
+# endif
 #endif
 }