Skip to content

Merge RootCmdOptions.RootContext and Context into a single field #6843

Description

@Suhail98

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions