Skip to content

Commit e13daaa

Browse files
committed
small fixes
1 parent 8850fac commit e13daaa

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

internal/enum/cli.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func defineArgumentFlags(fs *flag.FlagSet, args *Args) {
107107
fs.Var(&args.Ports, "p", "Ports separated by commas (default: 80, 443)")
108108
fs.Var(args.Resolvers, "r", "IP addresses of untrusted DNS resolvers (can be used multiple times)")
109109
fs.Var(args.Resolvers, "tr", "IP addresses of trusted DNS resolvers (can be used multiple times)")
110-
fs.IntVar(&args.Timeout, "timeout", 0, "Minutes to run without progress before terminating (Default: 30)")
110+
fs.IntVar(&args.Timeout, "timeout", 30, "Minutes to run without progress before terminating (Default: 30)")
111111
}
112112

113113
func defineOptionFlags(fs *flag.FlagSet, args *Args) {
@@ -236,11 +236,6 @@ func CLIWorkflow(cmdName string, clArgs []string) {
236236
}
237237
}
238238

239-
if args.Timeout == 0 {
240-
args.Timeout = 30
241-
}
242-
timeoutDur := time.Duration(args.Timeout) * time.Minute
243-
244239
var progress *pb.ProgressBar
245240
if !args.Options.Silent {
246241
progress = pb.Start64(int64(count))
@@ -249,10 +244,12 @@ func CLIWorkflow(cmdName string, clArgs []string) {
249244
done := make(chan struct{}, 1)
250245
go func() {
251246
var previous, finished int
252-
t := time.NewTicker(2 * time.Second)
253-
defer t.Stop()
247+
timeoutDur := time.Duration(args.Timeout) * time.Minute
248+
254249
term := time.NewTimer(timeoutDur)
255250
defer term.Stop()
251+
t := time.NewTicker(2 * time.Second)
252+
defer t.Stop()
256253

257254
for {
258255
select {

0 commit comments

Comments
 (0)