]> code.delx.au - gnu-emacs/blobdiff - src/callproc.c
*** empty log message ***
[gnu-emacs] / src / callproc.c
index 00068a908fbb057e2015c19bb51b7ba4a12fb6b3..effd7ecbb14db8fec548a3519429d3fccaf18bfc 100644 (file)
@@ -1,5 +1,5 @@
 /* Synchronous subprocess invocation for GNU Emacs.
-   Copyright (C) 1985,86,87,88,93,94,95,99, 2000, 2001
+   Copyright (C) 1985,86,87,88,93,94,95,99, 2000,01,02,03,04
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -123,6 +123,9 @@ int synch_process_alive;
 /* Nonzero => this is a string explaining death of synchronous subprocess.  */
 char *synch_process_death;
 
+/* Nonzero => this is the signal number that terminated the subprocess.  */
+int synch_process_termsig;
+
 /* If synch_process_death is zero,
    this is exit code of synchronous subprocess.  */
 int synch_process_retcode;
@@ -219,7 +222,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
   register int pid;
   char buf[16384];
   char *bufptr = buf;
-  int bufsize = 16384;
+  int bufsize = sizeof buf;
   int count = SPECPDL_INDEX ();
 
   register const unsigned char **new_argv
@@ -506,6 +509,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
        to avoid timing error if process terminates soon.  */
     synch_process_death = 0;
     synch_process_retcode = 0;
+    synch_process_termsig = 0;
 
     if (NILP (error_file))
       fd_error = emacs_open (NULL_DEVICE, O_WRONLY, 0);
@@ -803,6 +807,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
                  {
                    detect_coding (&process_coding, bufptr, nread);
                    if (process_coding.composing != COMPOSITION_DISABLED)
+                     /* We have not yet allocated the composition
+                        data because the coding type was undecided.  */
                      coding_allocate_composition_data (&process_coding, PT);
                  }
                if (process_coding.cmp_data)
@@ -977,6 +983,19 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
 
   unbind_to (count, Qnil);
 
+  if (synch_process_termsig)
+    {
+      char *signame;
+
+      synchronize_system_messages_locale ();
+      signame = strsignal (synch_process_termsig);
+
+      if (signame == 0)
+        signame = "unknown";
+
+      synch_process_death = signame;
+    }
+
   if (synch_process_death)
     return code_convert_string_norecord (build_string (synch_process_death),
                                         Vlocale_coding_system, 0);