forked from security/hakurei
internal/outcome: rename from app
This is less ambiguous, and more accurately describes the purpose of the package. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
27
internal/outcome/main.go
Normal file
27
internal/outcome/main.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package outcome
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"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("cannot seal app:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
seal.main(msg)
|
||||
panic("unreachable")
|
||||
}
|
||||
Reference in New Issue
Block a user