summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/tool/tool.lua2
-rw-r--r--xmake/tools/ar.lua5
-rw-r--r--xmake/tools/swiftc.lua7
3 files changed, 12 insertions, 2 deletions
diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua
index c885f9e48..a6d077de5 100644
--- a/xmake/core/tool/tool.lua
+++ b/xmake/core/tool/tool.lua
@@ -212,7 +212,7 @@ function tool.check(shellname, dirs)
-- check
assert(shellname)
-
+
-- attempt to check it directly first
if tool._check(shellname) then
return shellname
diff --git a/xmake/tools/ar.lua b/xmake/tools/ar.lua
index 0999672f1..9aaf70b80 100644
--- a/xmake/tools/ar.lua
+++ b/xmake/tools/ar.lua
@@ -68,5 +68,8 @@ end
function check(flags)
-- check it
- os.run("%s %s", _g.shellname, ifelse(flags, flags, ""))
+ local ok = os.execute("%s %s > %s 2>&1", _g.shellname, ifelse(flags, flags, ""), os.nuldev())
+ if ok ~= 0 and ok ~= 256 then
+ raise("not found!")
+ end
end
diff --git a/xmake/tools/swiftc.lua b/xmake/tools/swiftc.lua
index 65e6f8245..2cfc94cc0 100644
--- a/xmake/tools/swiftc.lua
+++ b/xmake/tools/swiftc.lua
@@ -110,3 +110,10 @@ function run(...)
os.run(...)
end
+-- check the given flags
+function check(flags)
+
+ -- check it
+ os.run("%s -h", _g.shellname)
+
+end