From 77dc207adf6d0c2bc07488ca4b5155d840087f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Sat, 20 Apr 2024 21:09:53 +0900 Subject: [PATCH] fix: notui --- main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 34fe9be..b8b281c 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "fmt" "os" "runtime" + "sync" "time" "github.com/fumiama/terasu/dns" @@ -57,7 +58,10 @@ func main() { } ctx, cancel := context.WithCancel(context.Background()) defer cancel() + wg := sync.WaitGroup{} + wg.Add(1) go func() { + defer wg.Done() if *dnsf != "" { f, err := os.Open(*dnsf) if err != nil { @@ -99,5 +103,9 @@ func main() { logrus.Warnln("download canceled") } }() - sc.show(time.Second) + if notui { + wg.Wait() + } else { + sc.show(time.Second) + } }