فهرست منبع

go ahead and wire up sig-proxy and no-stdin for consistency with underlying docker container attach

Signed-off-by: Wes Higbee <[email protected]>
Wes Higbee 1 سال پیش
والد
کامیت
80823b77ef
3فایلهای تغییر یافته به همراه10 افزوده شده و 5 حذف شده
  1. 6 5
      cmd/compose/attach.go
  2. 2 0
      pkg/api/api.go
  3. 2 0
      pkg/compose/attach_service.go

+ 6 - 5
cmd/compose/attach.go

@@ -31,11 +31,8 @@ type attachOpts struct {
 	index   int
 
 	detachKeys string
-
-	// todo docker container attach also has:
-	// --no-stdin  // whole point of attach is for STDIN (can already attach to STDOUT and STDERR via docker compose up)
-	// --sig-proxy
-
+	noStdin    bool
+	proxy      bool
 }
 
 func attachCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *cobra.Command {
@@ -61,6 +58,8 @@ func attachCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service
 	runCmd.Flags().IntVar(&opts.index, "index", 0, "index of the container if service has multiple replicas.")
 	runCmd.Flags().StringVarP(&opts.detachKeys, "detach-keys", "", "", "Override the key sequence for detaching from a container.")
 
+	runCmd.Flags().BoolVar(&opts.noStdin, "no-stdin", false, "Do not attach STDIN")
+	runCmd.Flags().BoolVar(&opts.proxy, "sig-proxy", true, "Proxy all received signals to the process")
 	return runCmd
 }
 
@@ -74,6 +73,8 @@ func runAttach(ctx context.Context, dockerCli command.Cli, backend api.Service,
 		Service:    opts.service,
 		Index:      opts.index,
 		DetachKeys: opts.detachKeys,
+		NoStdin:    opts.noStdin,
+		Proxy:      opts.proxy,
 	}
 	return backend.Attach(ctx, projectName, attachOpts)
 }

+ 2 - 0
pkg/api/api.go

@@ -350,6 +350,8 @@ type AttachOptions struct {
 	Service    string
 	Index      int
 	DetachKeys string
+	NoStdin    bool
+	Proxy      bool
 }
 
 // EventsOptions group options of the Events API

+ 2 - 0
pkg/compose/attach_service.go

@@ -33,5 +33,7 @@ func (s *composeService) Attach(ctx context.Context, projectName string, options
 
 	var attach container.AttachOptions
 	attach.DetachKeys = options.DetachKeys
+	attach.NoStdin = options.NoStdin
+	attach.Proxy = options.Proxy
 	return container.RunAttach(ctx, s.dockerCli, target.ID, &attach)
 }