From 4407892632d6cd7df455e584aa4efc22a2012f78 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 26 Mar 2026 15:10:11 +0900 Subject: [PATCH] cmd/mbf: optionally enter cure container This is very useful for troubleshooting failing tests and such. The ephemeral state is cleaned up by internal/pkg. Signed-off-by: Ophestra --- cmd/mbf/main.go | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go index 359458c0..16c2cf82 100644 --- a/cmd/mbf/main.go +++ b/cmd/mbf/main.go @@ -436,6 +436,7 @@ func main() { { var ( flagDump string + flagEnter bool flagExport string ) c.NewCommand( @@ -445,9 +446,13 @@ func main() { if len(args) != 1 { return errors.New("cure requires 1 argument") } - if p, ok := rosa.ResolveName(args[0]); !ok { + p, ok := rosa.ResolveName(args[0]) + if !ok { return fmt.Errorf("unknown artifact %q", args[0]) - } else if flagDump == "" { + } + + switch { + default: pathname, _, err := cache.Cure(rosa.Std.Load(p)) if err != nil { return err @@ -477,7 +482,8 @@ func main() { } return nil - } else { + + case flagDump != "": f, err := os.OpenFile( flagDump, os.O_WRONLY|os.O_CREATE|os.O_EXCL, @@ -493,6 +499,15 @@ func main() { } return f.Close() + + case flagEnter: + return cache.EnterExec( + ctx, + rosa.Std.Load(p), + true, os.Stdin, os.Stdout, os.Stderr, + rosa.AbsSystem.Append("bin", "mksh"), + "sh", + ) } }, ). @@ -505,6 +520,11 @@ func main() { &flagExport, "export", command.StringFlag(""), "Export cured artifact to specified pathname", + ). + Flag( + &flagEnter, + "enter", command.BoolFlag(false), + "Enter cure container with an interactive shell", ) }