File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ type SetupFunc func() error
1414type StartFunc func (ctx context.Context ) (context.Context , error )
1515type CleanupFunc func () error
1616
17- func Catnip (cfg * Config ) error {
17+ func Run (cfg * Config , ctx context. Context ) error {
1818 if err := cfg .Validate (); err != nil {
1919 return err
2020 }
@@ -77,10 +77,6 @@ func Catnip(cfg *Config) error {
7777 defer cfg .CleanupFunc ()
7878 }
7979
80- // Root Context
81- ctx , cancel := context .WithCancel (context .Background ())
82- defer cancel ()
83-
8480 if cfg .StartFunc != nil {
8581 if ctx , err = cfg .StartFunc (ctx ); err != nil {
8682 return err
Original file line number Diff line number Diff line change @@ -87,7 +87,11 @@ func main() {
8787 }),
8888 }
8989
90- chk (catnip .Catnip (& catnipCfg ), "failed to run catnip" )
90+ // Root Context
91+ ctx , cancel := context .WithCancel (context .Background ())
92+ defer cancel ()
93+
94+ chk (catnip .Run (& catnipCfg , ctx ), "failed to run catnip" )
9195}
9296
9397func doFlags (cfg * config ) bool {
You can’t perform that action at this time.
0 commit comments