all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: florian <lorian@fsavigny.de>
To: help-gnu-emacs@gnu.org
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)	[thread overview]
Message-ID: <c61a67d9-eea1-49fc-a462-ef788995e67c@3g2000yqk.googlegroups.com> (raw)
In-Reply-To: osprg52nd9.fsf@xoc2.stanford.edu

On Mar 26, 12:28 am, Glenn Morris <rgm+n...@stanford.edu> 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


  reply	other threads:[~2009-03-28 13:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-24 21:18 Using a command-line program (sqlite3) as a backend florian
2009-03-24 21:38 ` Chetan
2009-03-25 22:53   ` florian
2009-03-25 23:03     ` Chetan
2009-03-25 23:16       ` florian
2009-03-26  6:00         ` Harald Hanche-Olsen
2009-03-25  1:03 ` Glenn Morris
2009-03-25 23:11   ` florian
2009-03-25 23:28     ` Glenn Morris
2009-03-28 13:17       ` florian [this message]
2009-03-29  6:19         ` Using a command-line program (sqlite3) as a backend:observations with start-process rustom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c61a67d9-eea1-49fc-a462-ef788995e67c@3g2000yqk.googlegroups.com \
    --to=lorian@fsavigny.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.