Public source validation / validate (push) Failing after 3m8s
16 lines
335 B
Go
16 lines
335 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
)
|
|
|
|
// WaitForStop blocks until the context is cancelled or a signal is received.
|
|
// It accepts a channel so shutdown behavior can be tested without sending a real OS signal.
|
|
func WaitForStop(ctx context.Context, signals <-chan os.Signal) {
|
|
select {
|
|
case <-ctx.Done():
|
|
case <-signals:
|
|
}
|
|
}
|