|
|
@ -9,7 +9,7 @@ given <https://ocdoc.cil.li/tutorial:custom_oses#what_s_available>:
|
|
|
|
]]
|
|
|
|
]]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
envBase._OSVERSION = 'kitn 0.2.1-beta.5' --prefer [openloader, openos] "$name $ver" over plan9k "$name/$ver"
|
|
|
|
envBase._OSVERSION = 'kitn 0.2.1-beta.6' --prefer [openloader, openos] "$name $ver" over plan9k "$name/$ver"
|
|
|
|
envBase.kitn = {}
|
|
|
|
envBase.kitn = {}
|
|
|
|
envBase._G, envBase.load = nil
|
|
|
|
envBase._G, envBase.load = nil
|
|
|
|
|
|
|
|
|
|
|
@ -159,10 +159,33 @@ function fillEnv(proc, uenv)
|
|
|
|
return co
|
|
|
|
return co
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function ukitn.createProcess(path, ...)
|
|
|
|
local function assertFile(label, file)
|
|
|
|
checkArg(1, path, 'string')
|
|
|
|
if isFile(file) then
|
|
|
|
|
|
|
|
return file
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
error(label .. ' is not a file', 3)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ukitn.createProcess(init, ...)
|
|
|
|
|
|
|
|
local initT = checkArgEx(1, init, 'string', 'table')
|
|
|
|
|
|
|
|
local path, stdin, stdout, stderr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if initT == 'string' then
|
|
|
|
|
|
|
|
path = init
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
path, stdin, stdout, stderr = init.path, init.stdin, init.stdout, init.stderr
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
stdin = stdin and assertFile('stdin', stdin) or assertFile('inherited stdin', uio.stdin)
|
|
|
|
|
|
|
|
stdout = stdout and assertFile('stdout', stdout) or assertFile('inherited stdout', uio.stdout)
|
|
|
|
|
|
|
|
stderr = stderr and assertFile('stderr', stderr) or assertFile('inherited stderr', uio.stderr)
|
|
|
|
|
|
|
|
|
|
|
|
local co, info = createProcess(path, proc)
|
|
|
|
local co, info = createProcess(path, proc)
|
|
|
|
if not co then return nil, info end
|
|
|
|
if not co then return nil, info end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local newio = info.env.io
|
|
|
|
|
|
|
|
newio.stdin, newio.stdout, newio.stderr = stdin, stdout, stderr
|
|
|
|
runqueue[co] = pack(...)
|
|
|
|
runqueue[co] = pack(...)
|
|
|
|
return co
|
|
|
|
return co
|
|
|
|
end
|
|
|
|
end
|
|
|
|