diff options
author | Clement Farabet <clement.farabet@gmail.com> | 2012-08-20 19:34:02 +0400 |
---|---|---|
committer | Clement Farabet <clement.farabet@gmail.com> | 2012-08-20 19:34:02 +0400 |
commit | fa78bbfdbe876d9eda740fc70f59c434b4b39cdd (patch) | |
tree | 04b2266f5f5bd0231767217c382a1a911e97ce9d | |
parent | 423f4f621494c4b7b72a056423c95384f925598e (diff) |
Fixed little bug for sys.execute
-rw-r--r-- | init.lua | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -70,10 +70,9 @@ toc = function(verbose) -------------------------------------------------------------------------------- -- execute an OS command, but retrieves the result in a string -------------------------------------------------------------------------------- -execute = function(cmd) - local f = _G.assert(io.popen(cmd, 'r')) - local s = _G.assert(f:read('*a')) - f:close() +execute = function(cmd, readwhat) + local f = io.popen(cmd, 'r') + local s = f:read(readwhat or '*all') s = s:gsub('^%s*',''):gsub('%s*$','') return s end |