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:
authorSoumith Chintala <soumith@gmail.com>2016-08-25 02:14:05 +0300
committerGitHub <noreply@github.com>2016-08-25 02:14:05 +0300
commit6de204cc2254234f8c1caa418ac36d75ee3b0488 (patch)
treea47d1da50b151d0558be9a32410133a23ba84b54
parent8d2b8facd22e55d66ac71cb778f451694e7611fa (diff)
fixing readwhat option
-rw-r--r--init.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/init.lua b/init.lua
index 4596a92..3911ce4 100644
--- a/init.lua
+++ b/init.lua
@@ -48,11 +48,12 @@ sys.execute = execute
-- this call is typically more robust than the one above (on some systems)
--------------------------------------------------------------------------------
function sys.fexecute(cmd, readwhat)
+ readwhat = readwhat or '*all'
local tmpfile = os.tmpname()
local cmd = cmd .. ' 1>'.. tmpfile..' 2>' .. tmpfile
os.execute(cmd)
local file = _G.assert(io.open(tmpfile))
- local s = file:read('*all')
+ local s= file:read(readwhat)
file:close()
s = s:gsub('^%s*',''):gsub('%s*$','')
os.execute('rm ' .. tmpfile)