Follow-up from #6832, as suggested in review.
RootCmdOptions carries two contexts:
RootContext context.Context `mapstructure:"-"`
Context context.Context `mapstructure:"-"`
They used to be different: Context was a cancellable child of RootContext, so kamel run --sync could cancel the in-flight command and rerun it when a file changed, while RootContext kept the process alive. #6832 removed --sync and --dev, and with them the only caller of that cancel func, so it also dropped the child context. NewKamelCommand now sets both fields to the same ctx.
Proposal:
- drop
RootContext and keep Context
- its only reader is the
<-o.RootContext.Done() wait point after --logs in pkg/cmd/run.go, which becomes <-o.Context.Done() with no change in behaviour
I'm happy to pick this up.
Follow-up from #6832, as suggested in review.
RootCmdOptionscarries two contexts:They used to be different:
Contextwas a cancellable child ofRootContext, sokamel run --synccould cancel the in-flight command and rerun it when a file changed, whileRootContextkept the process alive. #6832 removed--syncand--dev, and with them the only caller of that cancel func, so it also dropped the child context.NewKamelCommandnow sets both fields to the samectx.Proposal:
RootContextand keepContext<-o.RootContext.Done()wait point after--logsinpkg/cmd/run.go, which becomes<-o.Context.Done()with no change in behaviourI'm happy to pick this up.