MCPcopy Create free account
hub / github.com/flant/shell-operator / Run

Method Run

pkg/shell-operator/operator.go:233–242  ·  view source on GitHub ↗

Run is a convenience that Start()s the operator, blocks until ctx is canceled, then performs a synchronous Shutdown with a derived timeout. Use it from main() and tests; library consumers that want fine-grained control should call Start and Shutdown directly.

(ctx context.Context)

Source from the content-addressed store, hash-verified

231// it from main() and tests; library consumers that want fine-grained control
232// should call Start and Shutdown directly.
233func (op *ShellOperator) Run(ctx context.Context) error {
234 if err := op.Start(ctx); err != nil {
235 return err
236 }
237 <-ctx.Done()
238
239 shutdownCtx, cancel := context.WithTimeout(context.Background(), DefaultShutdownTimeout)
240 defer cancel()
241 return op.Shutdown(shutdownCtx)
242}
243
244// Shutdown gracefully tears down everything started by Start. It is
245// synchronous: when Shutdown returns, no goroutine spawned by the operator is

Callers 2

startFunction · 0.95
handleRunHookMethod · 0.45

Calls 2

StartMethod · 0.95
ShutdownMethod · 0.95

Tested by

no test coverage detected