diff src/pager.cc @ 2209:859030f15706

[project @ 1996-05-15 11:46:43 by jwe]
author jwe
date Wed, 15 May 1996 11:46:48 +0000
parents 9be05ffc288a
children a3e39f8efed2
line wrap: on
line diff
--- a/src/pager.cc	Wed May 15 11:43:00 1996 +0000
+++ b/src/pager.cc	Wed May 15 11:46:48 1996 +0000
@@ -45,7 +45,7 @@
 #include "unwind-prot.h"
 #include "utils.h"
 
-pid_t octave_pager_pid = -1;
+static pid_t octave_pager_pid = -1;
 
 // Our actual connection to the external pager.
 static oprocstream *external_pager = 0;
@@ -93,6 +93,24 @@
 }
 
 static void
+pager_death_handler (pid_t pid, int status)
+{
+  if (pid > 0)
+    {
+      if (WIFEXITED (status) || WIFSIGNALLED (status))
+	{
+	  octave_pager_pid = -1;
+
+	  // Don't call error() here because we don't want to set
+	  // the error state.
+
+	  warning ("connection to external pager lost --");
+	  warning ("pending computations and output have been discarded");
+	}
+    }
+}
+
+static void
 do_sync (const char *msg, bool bypass_pager)
 {
   if (msg && *msg)
@@ -113,7 +131,12 @@
 		  external_pager = new oprocstream (pgr.c_str ());
 
 		  if (external_pager)
-		    octave_pager_pid = external_pager->pid ();
+		    {
+		      octave_pager_pid = external_pager->pid ();
+
+		      octave_child_list::insert (octave_pager_pid,
+						 pager_death_handler);
+		    }
 		}
 	    }