--local winapi = require "winapi"
local winapi = require "lua_ostasks.wincore"

module("lua_ostasks.windows", package.seeall)

---
--
function start (task, ...)
	local cmdline = task.task .. " " .. table.concat({...}, " ")	-- ojo con los nils
	
	local pid, err
	if task.working_directory then
		pid, err = winapi.spawn_process(cmdline, task.working_directory)
	else
		pid, err = winapi.spawn_process(cmdline)
	end
	
	if not pid then error(err) end
	return pid
end

---
--
function kill (pid)
	winapi.kill_process(pid)
	return true
end

---
-- 
function rmfile (filename)
	os.execute( ("del /Q /F %s"):format(filename) )
end
