Process.terminated readonly property
This property checks if the process is terminated, returning a boolean
value.
Example
local sysutils = require "sysutils"
local console = require "console"
local cmd
console.writecolor("green", "Launching cmd.exe (type exit to quit)...\n")
console.writecolor("green", "-------------------------------------------\n")
local p = sysutils.Process('cmd.exe', true, true)
function p:onRedirect(data)
if cmd then
data = tostring(data):gsub("^"..cmd, "")
end
console.writecolor("gray", data)
end
p:spawn()
while not p.terminated do
sleep(500)
cmd = console.readln()
if cmd == "exit" then
p:close()
break
end
p:write(cmd.."\n")
end
console.writecolor("green", "cmd.exe exited --------------\n")