Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/colony/lua/preload.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down