On Sun, Jan 19, 2014 at 11:10 AM, Christopher Wellons < well...@nullprogram.com> wrote:
> > When the shell is set to interactive (i.e. "-interactive"), the output > (stdout) is flushed with every prompt (shell.c:422) but stderr is not. > Stderr is suppose to be unbuffered so that flushing is not required. Or is that different for windows? > In some situations this leads to no error messages being displayed until > the stderr buffer fills. > > This happens when running the official sqlite3 binary as subprocess of > Emacs under Windows 7. The error messages do not appear in a timely > fashion. I was unable to trigger the misbehavior in a plain shell so my > only demo is a bit of Emacs Lisp. When this Elisp code below is run, a > buffer will pop up that *should* contain the output of .help. Under > Windows it does not. The same occurs even when it's launched via a shell > subprocess using "2>&1", so it's not simply an issue with Emacs not > reading from the subprocess's stderr output fast enough. > > (let* ((buffer (generate-new-buffer "sqlite")) > (proc (start-process "sqlite" buffer "sqlite3" "-interactive"))) > (process-send-string proc ".help\n") > (pop-to-buffer buffer)) > > I suspect it has to do with being compiled without readline, which is > why it behaves better elsewhere. I couldn't figure out how to link with > libreadline on Windows, though, so I couldn't test this. > > With the following change to the amalgamation release I got the behavior > I was looking for: timely error messages from the SQLite command line > shell. I understand this is probably not the Right Way to do this, but > it's just a demonstation of a possible fix. > > --- a/shell.c > +++ b/shell.c > @@ -418,6 +418,7 @@ static char *one_input_line(FILE *in, char *zPrior, > int isCont > zResult = readline(zPrompt); > if( zResult && *zResult ) add_history(zResult); > #else > + fflush(stderr); > printf("%s", zPrompt); > fflush(stdout); > zResult = local_getline(zPrior, stdin); > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users