# HG changeset patch # User Jacob Dawid # Date 1342704607 14400 # Node ID a6c44c28dabe50b792e0913c292644ae5b731bcb # Parent bc6c099eacc0321f5ae56c9b0ed6651543379e76 Added patch from jwe that forks the GUI process in order to have less work. * octave-gui.cc: Added forking before actually launching the GUI. diff --git a/gui/src/octave-gui.cc b/gui/src/octave-gui.cc --- a/gui/src/octave-gui.cc +++ b/gui/src/octave-gui.cc @@ -25,6 +25,32 @@ int main (int argc, char *argv[]) { + /* dissociate from the controlling terminal, if any */ + + pid_t pid = fork (); + if (pid < 0) + { + //fprintf (stderr, "fork failed\n"); + return 1; + } + else if (pid == 0) + { + /* child */ + //fprintf (stderr, "in child, calling setsid ()\n"); + + if (setsid () < 0) + { + //fprintf (stderr, "setsid error\n"); + return 1; + } + } + else + { + /* parent */ + //fprintf (stderr, "in parent, exiting\n"); + exit (0); + } + QApplication application (argc, argv); while (true) {