lua-users home
lua-l archive

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


On Tuesday 20 December 2005 12:26, Eduardo Ochs wrote:
> Hi list - is there a way to join Lua's stdout and stderr? In all the
> (few) ways that I've tried they kept using separate buffers, so if a
> program sends a lot of output to stdout and aborts with an error I get
> the error messages in the "wrong place", like this:

This is an OS issue, not a Lua issue --- Lua just hands the data over to the 
OS's stdout and stderr implementations.

You don't mention whether you're dealing with pure Lua code (in which case 
'io.stderr = io.stdout' will cause all output to appear over stdout), or 
whether you're mixing with native code. If the latter, then posix.close and 
posix.dup2 will allow you to close the underlying stderr file descriptor and 
clone stdout onto it.

-- 
+- David Given --McQ-+ 
|  dg@cowlark.com    | Quidquid latine dictum sit, altum viditur.
| (dg@tao-group.com) | 
+- www.cowlark.com --+ 

Attachment: pgpM9vD_6VzTX.pgp
Description: PGP signature