cmd/app: optionally override configured command
Test / Create distribution (push) Successful in 50s
Test / Sandbox (push) Successful in 2m45s
Test / ShareFS (push) Successful in 3m50s
Test / Hakurei (push) Successful in 4m1s
Test / Sandbox (race detector) (push) Successful in 5m33s
Test / Hakurei (race detector) (push) Successful in 6m35s
Test / Flake checks (push) Successful in 1m9s

Useful for multiple applications sharing state.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-06-20 01:31:07 +09:00
parent 7ab54b8c94
commit 4892beefc1
3 changed files with 58 additions and 44 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ func parse(id string, base *check.Absolute, r io.Reader) (*hst.Config, error) {
Shell: shell, Shell: shell,
Home: home, Home: home,
Path: shell, Path: shell,
Args: []string{"zsh", "-c"}, Args: []string{"zsh", "-ic"},
Flags: hst.FCoverRun, Flags: hst.FCoverRun,
}, },
+1 -1
View File
@@ -118,7 +118,7 @@ talk com.canonical.Unity
Home: hst.AbsPrivateTmp.Append("home"), Home: hst.AbsPrivateTmp.Append("home"),
Path: fhs.AbsRoot.Append("bin", "zsh"), Path: fhs.AbsRoot.Append("bin", "zsh"),
Args: []string{ Args: []string{
"zsh", "-c", "zsh", "-ic",
"exec Discord --ozone-platform-hint=wayland", "exec Discord --ozone-platform-hint=wayland",
}, },
+14
View File
@@ -141,6 +141,10 @@ func main() {
) )
} }
{
var (
flagCommand string
)
c.NewCommand( c.NewCommand(
"run", "Start the named application", "run", "Start the named application",
func(args []string) error { func(args []string) error {
@@ -189,9 +193,19 @@ func main() {
return err return err
} }
if flagCommand != "" {
config.Container.Args[2] = flagCommand
}
return run(ctx, msg, config) return run(ctx, msg, config)
}, },
).
Flag(
&flagCommand,
"command", command.StringFlag(""),
"Override configured command",
) )
}
c.MustParse(os.Args[1:], func(err error) { c.MustParse(os.Args[1:], func(err error) {
if e, ok := errors.AsType[*exec.ExitError](err); ok && e != nil { if e, ok := errors.AsType[*exec.ExitError](err); ok && e != nil {