[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using a command-line program (sqlite3) as a backend:observations wit

From: florian
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)
User-agent: G2/1.0

On Mar 26, 12:28 am, Glenn Morris <address@hidden> 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,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]