forked from actboy168/bee.lua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.lua
More file actions
30 lines (26 loc) · 647 Bytes
/
test.lua
File metadata and controls
30 lines (26 loc) · 647 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
local subprocess = require "bee.subprocess"
local thread = require "bee.thread"
local EXE = (require "bee.platform".OS == "Windows") and ".exe" or ""
local process = assert(subprocess.spawn {
"build/bin/bootstrap"..EXE, "test/test.lua", arg,
stdout = true,
stderr = "stdout",
})
while true do
local n = subprocess.peek(process.stdout)
if n == nil then
break
end
if n == 0 then
thread.sleep(0.1)
else
local data = process.stdout:read(n)
io.write(data)
io.flush()
end
end
process.stdout:close()
local code = process:wait()
if code ~= 0 then
os.exit(code, true)
end