handleSignals sets up signal handlers for Windows.
(ctx context.Context, cancel context.CancelFunc, logger *slog.Logger, srv *httpapi.Server)
| 13 | |
| 14 | // handleSignals sets up signal handlers for Windows. |
| 15 | func handleSignals(ctx context.Context, cancel context.CancelFunc, logger *slog.Logger, srv *httpapi.Server) { |
| 16 | shutdownCh := make(chan os.Signal, 1) |
| 17 | signal.Notify(shutdownCh, os.Interrupt) |
| 18 | go func() { |
| 19 | defer signal.Stop(shutdownCh) |
| 20 | sig := <-shutdownCh |
| 21 | logger.Info("Received shutdown signal", "signal", sig) |
| 22 | cancel() |
| 23 | }() |
| 24 | } |