mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 00:47:48 +08:00
exec, rollback: return error when no session found
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
This commit is contained in:
parent
508b2ef0c6
commit
ded91da575
@ -35,6 +35,9 @@ COMMAND and ARG... will be executed in the container.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cm *ExecCmd) Exec(ctx context.Context, args []string) error {
|
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 {
|
if len(args) < 2 {
|
||||||
return errors.Errorf("command must be passed")
|
return errors.Errorf("command must be passed")
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
controllerapi "github.com/docker/buildx/controller/pb"
|
controllerapi "github.com/docker/buildx/controller/pb"
|
||||||
"github.com/docker/buildx/monitor/types"
|
"github.com/docker/buildx/monitor/types"
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
type RollbackCmd struct {
|
type RollbackCmd struct {
|
||||||
@ -37,6 +38,9 @@ COMMAND and ARG... will be executed in the container.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (cm *RollbackCmd) Exec(ctx context.Context, args []string) error {
|
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
|
cfg := cm.invokeConfig
|
||||||
if len(args) >= 2 {
|
if len(args) >= 2 {
|
||||||
cmds := args[1:]
|
cmds := args[1:]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user