summaryrefslogtreecommitdiff
path: root/xmake/modules/detect/tools/find_ping.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2017-09-22 00:40:49 +0800
committerruki <[email protected]>2017-09-21 22:04:55 +0800
commitab5456ca3457c7b59de6cc590068d91d7749d096 (patch)
tree329742618ea8ef110542f27fa48f4226a20dde9c /xmake/modules/detect/tools/find_ping.lua
parent034185734b5bc91f8188c15c9e02b0ce8ebaa850 (diff)
modify find_program interface
Diffstat (limited to 'xmake/modules/detect/tools/find_ping.lua')
-rw-r--r--xmake/modules/detect/tools/find_ping.lua17
1 files changed, 9 insertions, 8 deletions
diff --git a/xmake/modules/detect/tools/find_ping.lua b/xmake/modules/detect/tools/find_ping.lua
index bf877a452..63d769d1e 100644
--- a/xmake/modules/detect/tools/find_ping.lua
+++ b/xmake/modules/detect/tools/find_ping.lua
@@ -35,14 +35,15 @@ import("lib.detect.find_program")
function main(opt)
-- init options
- opt = opt or {}
+ opt = opt or {}
+ opt.check = opt.check or function (program)
+ if os.host() == "windows" then
+ os.run("%s -n 1 127.0.0.1", program)
+ else
+ os.run("%s -c 1 127.0.0.1", program)
+ end
+ end
-- find program
- return find_program(opt.program or "ping", opt.pathes, opt.check or function (program)
- if os.host() == "windows" then
- os.run("%s -n 1 127.0.0.1", program)
- else
- os.run("%s -c 1 127.0.0.1", program)
- end
- end)
+ return find_program(opt.program or "ping", opt)
end