# HG changeset patch
# User Nick Roberts <nickrob@snap.net.nz>
# Date 1251608074 0
# Node ID 1eb83f01c48dfc15e0c11bcc269ed4c1faa925c8
# Parent  cd2c56c4b098d4cbdf351f3c056ddfa75ab62de3
(wait_reading_process_output): Keep the descriptor
when pty is used by a non-child process, e.g., in I/O buffer of
GDB this allows inferior to be restarted.

diff -r cd2c56c4b098 -r 1eb83f01c48d src/process.c
--- a/src/process.c	Sun Aug 30 04:50:49 2009 +0000
+++ b/src/process.c	Sun Aug 30 04:54:34 2009 +0000
@@ -5150,11 +5150,16 @@
 		 It can't hurt.  */
 	      else if (nread == -1 && errno == EIO)
 		{
-		  /* Clear the descriptor now, so we only raise the signal once.  */
-		  FD_CLR (channel, &input_wait_mask);
-		  FD_CLR (channel, &non_keyboard_wait_mask);
-
-		  kill (getpid (), SIGCHLD);
+		  /* Clear the descriptor now, so we only raise the
+		     signal once.  Don't do this is `process' is only
+		     a pty.  */
+		  if (XPROCESS (proc)->pid != -2)
+		    {
+		      FD_CLR (channel, &input_wait_mask);
+		      FD_CLR (channel, &non_keyboard_wait_mask);
+
+		      kill (getpid (), SIGCHLD);
+		    }
 		}
 #endif /* HAVE_PTYS */
 	      /* If we can detect process termination, don't consider the process