Skip to content

Commit 317068e

Browse files
committed
Fix signal handling to include SIGINT
1 parent 928b1ff commit 317068e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

main.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,15 @@ func parseFlags(flags *flags) {
166166
func handleSignals(ctx context.Context, stop chan<- bool, flags flags) {
167167
sigs := make(chan os.Signal, 1)
168168

169+
signal.Notify(sigs, syscall.SIGINT)
169170
signal.Notify(sigs, syscall.SIGTERM)
170171

171172
go func() {
173+
defer signal.Reset(syscall.SIGINT)
174+
defer signal.Reset(syscall.SIGTERM)
175+
176+
defer close(sigs)
177+
172178
loop:
173179
for {
174180
select {
@@ -184,9 +190,6 @@ func handleSignals(ctx context.Context, stop chan<- bool, flags flags) {
184190
}
185191
}
186192
}
187-
188-
signal.Reset(syscall.SIGTERM)
189-
close(sigs)
190193
}()
191194
}
192195

0 commit comments

Comments
 (0)