add command runner util

This commit is contained in:
2026-01-31 16:56:18 -05:00
parent 7fc4498dd7
commit b1ef556eb5
4 changed files with 21 additions and 2 deletions

View File

@@ -32,4 +32,15 @@ function M.ls(dir)
return t
end
function M.run(cmd)
cmd = cmd or "echo nil"
local p = io.popen(cmd)
if not p then
return nil
end
local r = p:read("*a"):gsub("%s+$", "")
p:close()
return r
end
return M