From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Frank Fischer Newsgroups: gmane.emacs.help Subject: Re: How to flush output to process Date: Sun, 6 Nov 2011 12:38:20 +0100 Message-ID: <20111106123820.37dfb047@purzel.home.lau> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1320579202 29297 80.91.229.12 (6 Nov 2011 11:33:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 6 Nov 2011 11:33:22 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 06 12:33:14 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RN0yQ-0004Ga-0q for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Nov 2011 12:33:14 +0100 Original-Received: from localhost ([::1]:39129 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RN0yP-00080d-4z for geh-help-gnu-emacs@m.gmane.org; Sun, 06 Nov 2011 06:33:13 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:45541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RN0yK-00080K-Em for help-gnu-emacs@gnu.org; Sun, 06 Nov 2011 06:33:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RN0yJ-0006sb-75 for help-gnu-emacs@gnu.org; Sun, 06 Nov 2011 06:33:08 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:38834) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RN0yJ-0006sP-1w for help-gnu-emacs@gnu.org; Sun, 06 Nov 2011 06:33:07 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RN0yI-0004F5-00 for help-gnu-emacs@gnu.org; Sun, 06 Nov 2011 12:33:06 +0100 Original-Received: from i59f6d527.versanet.de ([89.246.213.39]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Nov 2011 12:33:05 +0100 Original-Received: from frank-fischer by i59f6d527.versanet.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 06 Nov 2011 12:33:05 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 31 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: i59f6d527.versanet.de X-Newsreader: Claws Mail 3.7.6 (GTK+ 2.20.1; i486-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:82771 Archived-At: Am Sun, 06 Nov 2011 06:07:17 -0500 schrieb Eli Zaretskii : > > From: Frank Fischer > > Date: Sun, 6 Nov 2011 09:53:39 +0000 (UTC) > > > > In something like C I would use fflush(...) to force the buffered > > data to be sent to the process (and it works), but I have not been > > able to find some comparable function for Emacs Lisp. > > > > Is there a way the flush the Emacs->process stream, i.e., force all > > buffered data to be actually send to the process, from Emacs Lisp? > > I'm guessing that your analysis of the problem (and therefore the > solution you are seeking) is incorrect. I think it's the sub-process > who is buffering input until it sees a newline. > > To fix this, make sure your subprocess reads its stdin in raw mode, > not in cooked mode. Well, I cannot change the subprocess' code. But even if it is a problem of the subprocess, why does it work if I communicate with the subprocess from some other program, i.e., not starting the process from Emacs but from some other programming language, AND call the flush function of the corresponding stream? Btw, I would be surprised if it is indeed a problem of the subprocess as it is designed to be used in this way. Frank