changeset 3 | 508108deee63 |
child 39 | 237af42156a1 |
2:c7ac7b6a76e0 | 3:508108deee63 |
---|---|
1 |
|
2 function shcmd (cmd) |
|
3 if not cmd or cmd == "" then return nil, "No command" end |
|
4 |
|
5 local fullcmd = cmd.." 2> /dev/null" |
|
6 local fh = io.popen(fullcmd) |
|
7 result = fh:read("*a") -- read cmd output |
|
8 fh:close() |
|
9 -- Trim trailing newlines |
|
10 local r = result:gsub("\n+$", "") |
|
11 return r |
|
12 end |