librelist archives

« back to archive

Tir suppresses redirected stdout/stderr?

Tir suppresses redirected stdout/stderr?

From:
Matt Towers
Date:
2011-03-10 @ 23:27
It appears that something about entering Tir's main run loop is 
suppressing the ability to redirect stderr and stdout to a file.

Given a trivial handler named myhandler.lua:

	require 'tir/engine'

	local function go(web, req)

		print("did stuff")
	
	end

	print("handler starting")

	Tir.start {route = '/user_id_1_31Hgm7ED', main=go}


If this is run using:  "lua myhandler.lua"  the console output is:

	handler starting
	CONNECTING	/myhandler	38f857b8-cbaa-4b58-9271-0d36c27813c4	
tcp://127.0.0.1:9996	tcp://127.0.0.1:9997


However if it is run with any of the following commands, nothing is ever 
written to the log file:

	"lua myhandler.lua > myhandler.log"
	"lua myhandler.lua  | tee myhandler.log"
	"lua myhandler.lua 2>&1 myhandler.log"

If  Tir.start{...} is removed and the Lua script is allowed to execute 
normally using any of the above commands, the output is written as 
expected.

Anybody run into this or similar?

✈ Matt