[texworks] line buffered output

Charlie Sharpsteen chuck at sharpsteen.net
Mon Nov 21 23:18:16 CET 2011


On Sunday, November 20, 2011, Arno Trautmann <Arno.Trautmann at gmx.de> wrote:
> Hi all,
>
> following Tako's answer to a question on the LuaTeX list¹, it seems that
TeXworks' terminal output is block-buffered. That is suboptimal in some
special cases, as the one I'm describing in that mail. Is it possible to
change this in TeXworks?
>
> To explain my request: Look at the following plain LuaTeX example:
>
> \let\n\relax
> \directlua{
>  delay = 1.0
>  texio.write_nl("first comment\n")
>  os.sleep (delay)
>  texio.write("second comment\n")
>  os.sleep (delay)
> }
> \bye
>
> and have a look at the terminal output in TeXworks, in comparison to
compiling a normal terminal. The two comments should be output with a time
delay between them, which does not happen with TeXworks (at least not with
r.944 on x86_64 Arch Linux)
>
> Cheers
> Arno
>
> ¹http://tug.org/pipermail/luatex/2011-November/003352.html

I did some quick poking by setting the QProcess used to run typesetting
tools to use an `Unbuffered` stream. However, the log window still shows
the version string when LuaTeX starts up, then waits 2 seconds and shows
the rest of the output in one chunk after LuaTeX has finished.

I think the problem lies with LuaTeX as the behavior of just about every C
library is to block buffer output _unless_ the program is communicating
with a TTY or the programmer called something like `setbuf(stdout,
_IOLBUF)` or uses `fflush` at appropriate locations to flush stdout to the
calling process. So, after my test it looks like the log is getting block
buffered inside LuaTeX before it even crosses over to TeXworks.

Taco could provide a definite answer as to how stdout buffering is handled
on the LuaTeX side.

-Charlie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20111121/7b66d83c/attachment.html>


More information about the texworks mailing list