diff --git a/src/colony/lua/preload.lua b/src/colony/lua/preload.lua index 5249aa95..fd6add74 100644 --- a/src/colony/lua/preload.lua +++ b/src/colony/lua/preload.lua @@ -77,18 +77,15 @@ if not _G.COLONY_EMBED then -- This is temporary until we have proper compilation in C. colony._load = function (file) -- Compile JS script before running. - local status + assert(#_G.COLONY_COMPILER_PATH ~= 0, "COLONY_COMPILER_PATH is not defined") + local handle if jit == nil then - status = os.execute(_G.COLONY_COMPILER_PATH .. ' -m ' .. file .. ' > /tmp/colonyunique') + handle = io.popen(_G.COLONY_COMPILER_PATH .. ' -m "' .. file .. '"') else - status = os.execute(_G.COLONY_COMPILER_PATH .. ' -l ' .. file .. ' > /tmp/colonyunique') + handle = io.popen(_G.COLONY_COMPILER_PATH .. ' -l "' .. file .. '"') end - if status ~= 0 then - os.exit(status) - end - local file = io.open('/tmp/colonyunique', 'r') - local output = file:read('*all') - file:close() + local output = handle:read('*all') + handle:close() return output end end