summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules/io.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2019-08-19 23:54:32 +0800
committerruki <[email protected]>2019-08-19 17:27:13 +0800
commit905b289ecf007df7d30bcdcee927e46931639ea8 (patch)
treeaa0296aa54a9b349570a2d0f112c35806f3dc69e /xmake/core/sandbox/modules/io.lua
parent612dd5918297120bc7f0c2011fbbce90863fafaa (diff)
fix io.isatty
Diffstat (limited to 'xmake/core/sandbox/modules/io.lua')
-rw-r--r--xmake/core/sandbox/modules/io.lua12
1 files changed, 2 insertions, 10 deletions
diff --git a/xmake/core/sandbox/modules/io.lua b/xmake/core/sandbox/modules/io.lua
index 7ff2d1d5e..3d6a12011 100644
--- a/xmake/core/sandbox/modules/io.lua
+++ b/xmake/core/sandbox/modules/io.lua
@@ -31,6 +31,7 @@ local sandbox_io_file = sandbox_io_file or {}
local sandbox_io_filelock = sandbox_io_filelock or {}
sandbox_io._file = sandbox_io._file or io._file
sandbox_io._filelock = sandbox_io._filelock or io._filelock
+sandbox_io.lines = io.lines
-- get file size
function sandbox_io_file.size(file)
@@ -62,7 +63,7 @@ end
-- this file is a tty?
function sandbox_io_file.isatty(file)
local ok, errors = file:_isatty()
- if not ok then
+ if ok == nil then
raise(errors)
end
return ok
@@ -331,15 +332,6 @@ function sandbox_io.flush(file)
return (file or sandbox_io.stdout):flush()
end
--- read lines from the given file
-function sandbox_io.lines(filepath, opt)
- local iter, data_or_errors = io.lines(filepath, opt)
- if not iter and data_or_errors then
- raise(data_or_errors)
- end
- return iter, data_or_errors
-end
-
-- isatty
function sandbox_io.isatty(file)
file = file or sandbox_io.stdout