changeset 13931:c80fb27c183b

(win32_wait): fixed bad synch_process_retcode and initialized synch_process_death if signaled.
author Geoff Voelker <voelker@cs.washington.edu>
date Thu, 04 Jan 1996 03:07:38 +0000
parents badba571804f
children de7851688890
files src/w32proc.c
diffstat 1 files changed, 24 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32proc.c	Thu Jan 04 03:05:24 1996 +0000
+++ b/src/w32proc.c	Thu Jan 04 03:07:38 1996 +0000
@@ -34,6 +34,12 @@
 #include "lisp.h"
 #include "nt.h"
 #include "systime.h"
+#include "syswait.h"
+#include "process.h"
+
+#ifndef SYS_SIGLIST_DECLARED
+extern char *sys_siglist[];
+#endif
 
 /* #define FULL_DEBUG */
 
@@ -330,10 +336,6 @@
    When it does, close its handle
    Return the pid and fill in the status if non-NULL.  */
 
-/* From callproc.c */
-extern int synch_process_alive;
-extern int synch_process_retcode;
-
 int 
 win32_wait (int *status)
 {
@@ -423,8 +425,25 @@
   else if (synch_process_alive)
     {
       synch_process_alive = 0;
-      synch_process_retcode = retval;
 
+      /* Report the status of the synchronous process.  */
+      if (WIFEXITED (retval))
+	synch_process_retcode = WRETCODE (retval);
+      else if (WIFSIGNALED (retval))
+	{
+	  int code = WTERMSIG (retval);
+	  char *signame = 0;
+	  
+	  if (code < NSIG)
+	    {
+	      /* Suppress warning if the table has const char *.  */
+	      signame = (char *) sys_siglist[code];
+	    }
+	  if (signame == 0)
+	    signame = "unknown";
+
+	  synch_process_death = signame;
+	}
       TerminateThread (cp->thrd, 0);
       CloseHandle (cp->thrd);
       CloseHandle (cp->char_consumed);