INNER CODE UNIT · Go
runWithShutdownTimeout
deviceinsight/kafkactl · main.go:47
func runWithShutdownTimeout(ctx context.Context, shutdownTimeout time.Duration) error {
errChan := make(chan error, 1)
ioStreams := output.DefaultIOStreams()
rootCmd := cmd.NewKafkactlCommand(ioStreams)
go func() {
errChan <- rootCmd.ExecuteContext(ctx)
close(errChan)
}()
select {
case err := <-errChan:
return err
case <-ctx.Done():
output.Debugf("Shutdown signal received, allowing %v for graceful shutdown...", shutdownTimeout)
select {