summaryrefslogtreecommitdiff
path: root/make/unittest.lua
blob: eb9eda66731a70e686a06c3b41d7a2952bcb5363 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
local platform = ...
local fs = require 'bee.filesystem'
local sp = require 'bee.subprocess'
local pf = require 'bee.platform'
local exe = platform == 'msvc' and ".exe" or ""
local CWD = fs.current_path()

local process = assert(sp.spawn {
    CWD / 'server' / pf.OS / 'bin' / ('lua' .. exe),
    CWD / 'server' / 'test.lua',
    '-E',
    stdout = true,
    stderr = true,
})

for line in process.stdout:lines 'l' do
    print(line)
end
process:wait()
local err = process.stderr:read 'a'
if err ~= '' then
    error(err)
end