Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/sys.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Farabet <clement.farabet@gmail.com>2012-08-20 19:34:02 +0400
committerClement Farabet <clement.farabet@gmail.com>2012-08-20 19:34:02 +0400
commitfa78bbfdbe876d9eda740fc70f59c434b4b39cdd (patch)
tree04b2266f5f5bd0231767217c382a1a911e97ce9d
parent423f4f621494c4b7b72a056423c95384f925598e (diff)
Fixed little bug for sys.execute
-rw-r--r--init.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/init.lua b/init.lua
index ca444c9..9718919 100644
--- a/init.lua
+++ b/init.lua
@@ -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