summaryrefslogtreecommitdiff
path: root/xmake/core/base/io.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-09-07 11:55:37 +0800
committerruki <[email protected]>2017-09-07 11:55:37 +0800
commitf7fe93d37dd1e863a09c0d41f7ec74200cc9242c (patch)
tree8f921a530ce419499c04712d780e452aaff4d414 /xmake/core/base/io.lua
parentb64cfa7b328df9cb389821c9348b4774024b251a (diff)
disable to output colors code to file
Diffstat (limited to 'xmake/core/base/io.lua')
-rw-r--r--xmake/core/base/io.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/xmake/core/base/io.lua b/xmake/core/base/io.lua
index bf794da17..8da88b10e 100644
--- a/xmake/core/base/io.lua
+++ b/xmake/core/base/io.lua
@@ -31,8 +31,9 @@ local path = require("base/path")
local table = require("base/table")
local utils = require("base/utils")
--- save original open
-io._open = io._open or io.open
+-- save original apis
+io._open = io._open or io.open
+io._isatty = io._isatty or io.isatty
-- read file
function _file:read(...)
@@ -239,6 +240,14 @@ function io.writefile(filepath, data)
return true
end
+-- replace the original isatty interface
+function io.isatty(fd)
+ if io._ISATTY == nil then
+ io._ISATTY = io._isatty(fd or io.stdout)
+ end
+ return io._ISATTY
+end
+
-- replace the original open interface
function io.open(filepath, mode)