Skip to content

Commit ccac8b0

Browse files
committed
Return non zero exit code on unknown server errors
1 parent 91d93ad commit ccac8b0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

main.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ func main() {
2828
ReadTimeout: 10 * time.Second,
2929
}
3030

31-
log.Printf("Server starting on port %s", port)
3231
shutdownChannel := make(chan os.Signal, 10)
3332
go func() {
33+
log.Printf("Server starting on port %s", port)
3434
err := httpServer.ListenAndServe()
3535
if err != nil {
3636
log.Printf("Server Error: %s", err)
@@ -45,4 +45,9 @@ func main() {
4545
shutdownSignal := <-shutdownChannel
4646
log.Printf("Received signal (%s), shutting down...", shutdownSignal.String())
4747
httpServer.Shutdown(context.Background())
48+
49+
// Exit was not expected, return non 0 exit code
50+
if shutdownSignal == syscall.SIGUSR1 {
51+
os.Exit(1)
52+
}
4853
}

0 commit comments

Comments
 (0)