From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: florian Newsgroups: gmane.emacs.help Subject: Re: Using a command-line program (sqlite3) as a backend:observations with start-process Date: Sat, 28 Mar 2009 06:17:18 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1238247677 32254 80.91.229.12 (28 Mar 2009 13:41:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 Mar 2009 13:41:17 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 28 14:42:35 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LnYnq-0003cD-KB for geh-help-gnu-emacs@m.gmane.org; Sat, 28 Mar 2009 14:42:26 +0100 Original-Received: from localhost ([127.0.0.1]:35694 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LnYmT-0001E9-Fa for geh-help-gnu-emacs@m.gmane.org; Sat, 28 Mar 2009 09:41:01 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2.glorb.com!postnews.google.com!3g2000yqk.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-NNTP-Posting-Host: 88.78.18.252 Original-X-Trace: posting.google.com 1238246238 7383 127.0.0.1 (28 Mar 2009 13:17:18 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Sat, 28 Mar 2009 13:17:18 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 3g2000yqk.googlegroups.com; posting-host=88.78.18.252; posting-account=D6LMWQoAAAA9mPFBi-XXlCxVbyI2qOo- User-Agent: G2/1.0 X-HTTP-UserAgent: Opera/9.61 (X11; Linux i686; U; en) Presto/2.1.1,gzip(gfe),gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:168067 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:63356 Archived-At: On Mar 26, 12:28=A0am, Glenn Morris wrote: > This was recently fixed I have to admit I did not have the patience to examine this more thoroughly than to find out that it uses comint.el, which (since I did not want an interactive thing) uses start-process. So I went ahead writing my stuff using start-process. It did work, except for one problem, which caused me to abandon the approach and write a synchronous interface instead: When using start-process, it seems rather nontrivial to tell when the subprocess is done with its output: how often the filter function I defined would be called did not seem to be predictable. The solution I could think of, defining the filter function such as to collect and concatenate any output until it received a string ending with the prompt, only worked under some circumstances (and the other solution I could think of, waiting for some amount of time, and then assuming sqlite3 should be done, seemed like nothing more than a kludge): When the subprocess is started using a pseudo-TTY, all output eventually seems to reach Emacs. But when it is started using a pipe, the prompt (and also the welcome message, for that matter) is never received. Under Windows, start-process apparently always uses a pipe, so the only signal to tell the output is complete is not received. I am not sure if I abandoned this prematurely (after all, ispell.el seems to work even under Windows), but in any case, the Elisp documentation is a little scarce on which output is received and which is not: "It is impossible to separate the standard output and standard error streams of the subprocess, because Emacs normally spawns the subprocess inside a pseudo-TTY, and a pseudo-TTY has only one output channel." is all I can find, but this does not really explain it (and from experiments with sqlite3 on the command line, it seems far from clear that stderr/stdout could be the explanation). Thanks for your help, Florian