fix `-p=0` don't print result bug
This commit is contained in:
parent
2c46cfcd0f
commit
272eb40d5b
3
main.go
3
main.go
|
@ -119,6 +119,9 @@ func main() {
|
|||
}
|
||||
|
||||
func endPrint() {
|
||||
if utils.NoPrintResult() {
|
||||
return
|
||||
}
|
||||
if runtime.GOOS == "windows" { // 如果是 Windows 系统,则需要按下 回车键 或 Ctrl+C 退出(避免通过双击运行时,测速完毕后直接关闭)
|
||||
fmt.Println("\n按下 回车键 或 Ctrl+C 退出。")
|
||||
var pause int
|
||||
|
|
|
@ -23,6 +23,10 @@ var (
|
|||
PrintNum = 10
|
||||
)
|
||||
|
||||
func NoPrintResult() bool {
|
||||
return PrintNum == 0
|
||||
}
|
||||
|
||||
type PingData struct {
|
||||
IP *net.IPAddr
|
||||
Sended int
|
||||
|
@ -132,6 +136,9 @@ func (s DownloadSpeedSet) Swap(i, j int) {
|
|||
}
|
||||
|
||||
func (s DownloadSpeedSet) Print(ipv6 bool) {
|
||||
if NoPrintResult() {
|
||||
return
|
||||
}
|
||||
if len(s) <= 0 { // IP数组长度(IP数量) 大于 0 时继续
|
||||
fmt.Println("\n[信息] 完整测速结果 IP 数量为 0,跳过输出结果。")
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue