From 13a3cacd9325800cb54e953a1f46fb85facf3c46 Mon Sep 17 00:00:00 2001 From: shadow1ng Date: Tue, 17 Nov 2020 16:04:56 +0800 Subject: [PATCH] =?UTF-8?q?mac=E4=B8=8B=E4=BF=AE=E6=94=B9ping=E6=89=80?= =?UTF-8?q?=E9=9C=80=E7=9A=84bash=E8=B7=AF=E5=BE=84,=E6=94=B9=E4=B8=BA/bin?= =?UTF-8?q?/bash=E3=80=82(=E5=8E=9F=E4=B8=BA/usr/local/bin/bash),=E5=B9=B6?= =?UTF-8?q?=E6=8A=8A=E8=B6=85=E6=97=B6=E5=8F=82=E6=95=B0=E7=94=B1-w=20?= =?UTF-8?q?=E6=94=B9=E4=B8=BA-W=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Plugins/icmp.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Plugins/icmp.go b/Plugins/icmp.go index bb9c75d..c92c5d2 100644 --- a/Plugins/icmp.go +++ b/Plugins/icmp.go @@ -142,8 +142,10 @@ func ExecCommandPing(ip string, bsenv string) bool { var command *exec.Cmd if SysInfo.OS == "windows" { command = exec.Command("cmd", "/c", "ping -n 1 -w 1 "+ip+" && echo true || echo false") //ping -c 1 -i 0.5 -t 4 -W 2 -w 5 "+ip+" >/dev/null && echo true || echo false" - } else { + } else if SysInfo.OS == "linux" { command = exec.Command(bsenv, "-c", "ping -c 1 -w 1 "+ip+" >/dev/null && echo true || echo false") //ping -c 1 -i 0.5 -t 4 -W 2 -w 5 "+ip+" >/dev/null && echo true || echo false" + } else if SysInfo.OS == "darwin" { + command = exec.Command(bsenv, "-c", "ping -c 1 -W 1 "+ip+" >/dev/null && echo true || echo false") //ping -c 1 -i 0.5 -t 4 -W 2 -w 5 "+ip+" >/dev/null && echo true || echo false" } outinfo := bytes.Buffer{} command.Stdout = &outinfo