소스 검색

Merge pull request #8788 from debdutdeb/8784-timeout-param

Fix compose down --timeout/-t flag
Mathieu Champlon 4 년 전
부모
커밋
555b0ab0da
2개의 변경된 파일2개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 3
      cmd/compose/down.go
  2. 1 3
      cmd/compose/up.go

+ 1 - 3
cmd/compose/down.go

@@ -43,10 +43,8 @@ func downCommand(p *projectOptions, backend api.Service) *cobra.Command {
 	downCmd := &cobra.Command{
 		Use:   "down",
 		Short: "Stop and remove containers, networks",
-		PreRun: func(cmd *cobra.Command, args []string) {
+		PreRunE: AdaptCmd(func(ctx context.Context, cmd *cobra.Command, args []string) error {
 			opts.timeChanged = cmd.Flags().Changed("timeout")
-		},
-		PreRunE: Adapt(func(ctx context.Context, args []string) error {
 			if opts.images != "" {
 				if opts.images != "all" && opts.images != "local" {
 					return fmt.Errorf("invalid value for --rmi: %q", opts.images)

+ 1 - 3
cmd/compose/up.go

@@ -98,10 +98,8 @@ func upCommand(p *projectOptions, backend api.Service) *cobra.Command {
 	upCmd := &cobra.Command{
 		Use:   "up [SERVICE...]",
 		Short: "Create and start containers",
-		PreRun: func(cmd *cobra.Command, args []string) {
+		PreRunE: AdaptCmd(func(ctx context.Context, cmd *cobra.Command, args []string) error {
 			create.timeChanged = cmd.Flags().Changed("timeout")
-		},
-		PreRunE: Adapt(func(ctx context.Context, args []string) error {
 			if up.exitCodeFrom != "" {
 				up.cascadeStop = true
 			}