changeset 23879:18e5d1cfa74b

(read_process_output): If NBYTES is zero and CODING_MODE_LAST_BLOCK bit is not yet set in coding->mode, set it and try decoding again. (Fprocess_send_eof): If the coding system of PROCESS requires flushing, call send_process with null-string at first.
author Kenichi Handa <handa@m17n.org>
date Tue, 15 Dec 1998 04:35:38 +0000
parents 0d713a8426b6
children 522ac99a666d
files src/process.c
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/process.c	Tue Dec 15 04:35:38 1998 +0000
+++ b/src/process.c	Tue Dec 15 04:35:38 1998 +0000
@@ -2841,7 +2841,12 @@
 
   /* At this point, NBYTES holds number of characters just received
      (including the one in proc_buffered_char[channel]).  */
-  if (nbytes <= 0) return nbytes;
+  if (nbytes <= 0)
+    {
+      if (nbytes < 0 || coding->mode & CODING_MODE_LAST_BLOCK)
+	return nbytes;
+      coding->mode |= CODING_MODE_LAST_BLOCK;
+    }
 
   /* Now set NBYTES how many bytes we must decode.  */
   nbytes += carryover;
@@ -3846,8 +3851,10 @@
      Lisp_Object process;
 {
   Lisp_Object proc;
+  struct coding_system *coding;
 
   proc = get_process (process);
+  coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)];
 
   /* Make sure the process is really alive.  */
   if (! NILP (XPROCESS (proc)->raw_status_low))
@@ -3855,6 +3862,12 @@
   if (! EQ (XPROCESS (proc)->status, Qrun))
     error ("Process %s not running", XSTRING (XPROCESS (proc)->name)->data);
 
+  if (CODING_REQUIRE_FLUSHING (coding))
+    {
+      coding->mode |= CODING_MODE_LAST_BLOCK;
+      send_process (proc, "", 0, Qnil);
+    }
+
 #ifdef VMS
   send_process (proc, "\032", 1, Qnil); 	/* ^z */
 #else