mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 01:53:42 +08:00 
			
		
		
		
	simplify signal handling for cobra context
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
		@@ -15,7 +15,6 @@ import (
 | 
			
		||||
	"github.com/docker/buildx/builder"
 | 
			
		||||
	"github.com/docker/buildx/localstate"
 | 
			
		||||
	"github.com/docker/buildx/util/buildflags"
 | 
			
		||||
	"github.com/docker/buildx/util/cobrautil"
 | 
			
		||||
	"github.com/docker/buildx/util/cobrautil/completion"
 | 
			
		||||
	"github.com/docker/buildx/util/confutil"
 | 
			
		||||
	"github.com/docker/buildx/util/desktop"
 | 
			
		||||
@@ -262,7 +261,7 @@ func bakeCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command {
 | 
			
		||||
		Use:     "bake [OPTIONS] [TARGET...]",
 | 
			
		||||
		Aliases: []string{"f"},
 | 
			
		||||
		Short:   "Build from a file",
 | 
			
		||||
		RunE: cobrautil.ConfigureContext(func(cmd *cobra.Command, args []string) error {
 | 
			
		||||
		RunE: func(cmd *cobra.Command, args []string) error {
 | 
			
		||||
			// reset to nil to avoid override is unset
 | 
			
		||||
			if !cmd.Flags().Lookup("no-cache").Changed {
 | 
			
		||||
				cFlags.noCache = nil
 | 
			
		||||
@@ -274,7 +273,7 @@ func bakeCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command {
 | 
			
		||||
			options.metadataFile = cFlags.metadataFile
 | 
			
		||||
			// Other common flags (noCache, pull and progress) are processed in runBake function.
 | 
			
		||||
			return runBake(cmd.Context(), dockerCli, args, options, cFlags)
 | 
			
		||||
		}),
 | 
			
		||||
		},
 | 
			
		||||
		ValidArgsFunction: completion.BakeTargets(options.files),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user