All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m16s
Test / Hakurei (push) Successful in 3m11s
Test / Sandbox (race detector) (push) Successful in 4m4s
Test / Hpkg (push) Successful in 4m8s
Test / Hakurei (race detector) (push) Successful in 4m56s
Test / Flake checks (push) Successful in 1m19s
This also increases precision of state time output. Signed-off-by: Ophestra <cat@gensokyo.uk>
31 lines
713 B
Go
31 lines
713 B
Go
package outcome
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"time"
|
|
|
|
"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}}
|
|
|
|
finaliseTime := time.Now()
|
|
if err := seal.finalise(ctx, msg, &id, config); err != nil {
|
|
printMessageError(msg.GetLogger().Fatalln, "cannot seal app:", err)
|
|
panic("unreachable")
|
|
}
|
|
msg.Verbosef("finalise took %.2f ms", float64(time.Since(finaliseTime).Nanoseconds())/1e6)
|
|
|
|
seal.main(msg)
|
|
panic("unreachable")
|
|
}
|