From: Kenichi Handa Date: Tue, 15 Dec 1998 04:35:38 +0000 (+0000) Subject: (read_process_output): If NBYTES is zero and X-Git-Tag: emacs-20.4~1070 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=de7fbd0989386dc9de4feff5f0d87d078c5ae581;p=emacs.git (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. --- diff --git a/src/process.c b/src/process.c index a65eb2413d7..941e0a266d9 100644 --- a/src/process.c +++ b/src/process.c @@ -2841,7 +2841,12 @@ read_process_output (proc, channel) /* 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 @@ text to PROCESS after you call this function.") 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 @@ text to PROCESS after you call this function.") 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