Skip to content

Commit

Permalink
exec, rollback: return error when no session found
Browse files Browse the repository at this point in the history
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
  • Loading branch information
ktock committed Oct 13, 2023
1 parent 508b2ef commit ded91da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions monitor/commands/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ COMMAND and ARG... will be executed in the container.
}

func (cm *ExecCmd) Exec(ctx context.Context, args []string) error {
if ref := cm.m.AttachedSessionID(); ref == "" {
return errors.Errorf("no attaching session")
}
if len(args) < 2 {
return errors.Errorf("command must be passed")
}
Expand Down
4 changes: 4 additions & 0 deletions monitor/commands/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

controllerapi "github.com/docker/buildx/controller/pb"
"github.com/docker/buildx/monitor/types"
"github.com/pkg/errors"
)

type RollbackCmd struct {
Expand Down Expand Up @@ -37,6 +38,9 @@ COMMAND and ARG... will be executed in the container.
}

func (cm *RollbackCmd) Exec(ctx context.Context, args []string) error {
if ref := cm.m.AttachedSessionID(); ref == "" {
return errors.Errorf("no attaching session")
}
cfg := cm.invokeConfig
if len(args) >= 2 {
cmds := args[1:]
Expand Down

0 comments on commit ded91da

Please sign in to comment.