All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m13s
Test / Hakurei (push) Successful in 3m9s
Test / Hpkg (push) Successful in 3m57s
Test / Sandbox (race detector) (push) Successful in 4m8s
Test / Hakurei (race detector) (push) Successful in 4m54s
Test / Flake checks (push) Successful in 1m27s
This makes it possible to instrument output behaviour through stub. Signed-off-by: Ophestra <cat@gensokyo.uk>
27 lines
584 B
Go
27 lines
584 B
Go
package outcome
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
|
|
"hakurei.app/hst"
|
|
"hakurei.app/message"
|
|
)
|
|
|
|
// Main runs an app according to [hst.Config] and terminates. Main does not return.
|
|
func Main(ctx context.Context, msg message.Msg, config *hst.Config) {
|
|
var id hst.ID
|
|
if err := hst.NewInstanceID(&id); err != nil {
|
|
log.Fatal(err.Error())
|
|
}
|
|
|
|
seal := outcome{syscallDispatcher: direct{msg}}
|
|
if err := seal.finalise(ctx, msg, &id, config); err != nil {
|
|
printMessageError(msg.GetLogger().Fatalln, "cannot seal app:", err)
|
|
panic("unreachable")
|
|
}
|
|
|
|
seal.main(msg)
|
|
panic("unreachable")
|
|
}
|