This is an automated email from the ASF dual-hosted git repository.

squakez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new 81e774d5b Fix #6843: merge RootCmdOptions.RootContext into Context
81e774d5b is described below

commit 81e774d5b4e0bb09f4f2419cbfe5a59ae0c632a6
Author: Suhail Hany <[email protected]>
AuthorDate: Sun Oct 25 12:56:35 2026 +0300

    Fix #6843: merge RootCmdOptions.RootContext into Context
    
    Since #6832 dropped the cancellable child context that kamel run --sync
    used, NewKamelCommand sets RootContext and Context to the same ctx. Keep
    Context and move the only RootContext reader, the wait point after
    kamel run --logs, over to it. Both fields held the same value, so the
    wait blocks on the same channel as before.
---
 pkg/cmd/root.go | 18 ++++++++----------
 pkg/cmd/run.go  |  2 +-
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go
index 24cffb176..54e1fa2c5 100644
--- a/pkg/cmd/root.go
+++ b/pkg/cmd/root.go
@@ -40,21 +40,19 @@ superpowers.
 //
 //nolint:containedctx
 type RootCmdOptions struct {
-       RootContext context.Context `mapstructure:"-"`
-       Context     context.Context `mapstructure:"-"`
-       _client     client.Client   `mapstructure:"-"`
-       Flags       *viper.Viper    `mapstructure:"-"`
-       KubeConfig  string          `mapstructure:"kube-config"`
-       Namespace   string          `mapstructure:"namespace"`
-       Verbose     bool            `mapstructure:"verbose"     
yaml:",omitempty"`
+       Context    context.Context `mapstructure:"-"`
+       _client    client.Client   `mapstructure:"-"`
+       Flags      *viper.Viper    `mapstructure:"-"`
+       KubeConfig string          `mapstructure:"kube-config"`
+       Namespace  string          `mapstructure:"namespace"`
+       Verbose    bool            `mapstructure:"verbose"     
yaml:",omitempty"`
 }
 
 // NewKamelCommand --.
 func NewKamelCommand(ctx context.Context) (*cobra.Command, error) {
        options := RootCmdOptions{
-               RootContext: ctx,
-               Context:     ctx,
-               Flags:       viper.New(),
+               Context: ctx,
+               Flags:   viper.New(),
        }
 
        cmd := kamelPreAddCommandInit(&options)
diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index b3ae9931e..fb4f0188e 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -372,7 +372,7 @@ func (o *runCmdOptions) run(cmd *cobra.Command, args 
[]string) error {
                        return err
                }
                // Let's add a Wait point, otherwise the script terminates
-               <-o.RootContext.Done()
+               <-o.Context.Done()
        }
 
        return nil

Reply via email to