aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-03-26 15:10:11 +0900
committerOphestra <cat@gensokyo.uk>2026-03-26 15:10:11 +0900
commit4407892632d6cd7df455e584aa4efc22a2012f78 (patch)
tree1a23d9193860e7c609262e25bae9f1af7d7559b9
parente661260607573009d0f7b0cbcbb8ee561fc08f3f (diff)
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 <cat@gensokyo.uk>
-rw-r--r--cmd/mbf/main.go26
1 files 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",
)
}