cmd/app: start application from configuration
Test / Create distribution (push) Successful in 59s
Test / Sandbox (push) Successful in 3m3s
Test / ShareFS (push) Successful in 4m14s
Test / Hakurei (push) Successful in 4m28s
Test / Sandbox (race detector) (push) Successful in 5m48s
Test / Hakurei (race detector) (push) Successful in 7m1s
Test / Flake checks (push) Successful in 1m13s

This is currently not very usable due to hakurei immutable overlay mount limitations.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-06-17 01:54:29 +09:00
parent 323dcb2820
commit 28e133c298
+30
View File
@@ -6,8 +6,10 @@ package main
import (
"context"
"errors"
"log"
"os"
"os/exec"
"os/signal"
"path/filepath"
"syscall"
@@ -124,7 +126,35 @@ func main() {
)
}
c.NewCommand(
"run", "Start the named application",
func(args []string) error {
if len(args) != 1 {
return errors.New("run requires 1 argument")
}
var config *hst.Config
f, err := os.Open(base.Append("app", args[0]).String())
if err != nil {
return err
}
config, err = parse(args[0], base, f)
if closeErr := f.Close(); err == nil {
err = closeErr
}
if err != nil {
return err
}
return run(ctx, msg, config)
},
)
c.MustParse(os.Args[1:], func(err error) {
if e, ok := errors.AsType[*exec.ExitError](err); ok && e != nil {
os.Exit(e.ExitCode())
}
if w, ok := err.(interface{ Unwrap() []error }); !ok {
log.Fatal(err)
} else {