aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/outcome/main.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-14 01:06:14 +0900
committerOphestra <cat@gensokyo.uk>2025-11-14 01:06:14 +0900
commita9d72a5eb19827ded874e359a99f91cc4d91f4b3 (patch)
tree33d5082f967858a443ef080572809b311f38c361 /internal/outcome/main.go
parent6d14bb814f276fd61ca3ff75cb279815cf1bb95d (diff)
internal/outcome: rename run from main
The "main.go" name is quite confusing as this is often only present in main packages. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/outcome/main.go')
-rw-r--r--internal/outcome/main.go45
1 files changed, 0 insertions, 45 deletions
diff --git a/internal/outcome/main.go b/internal/outcome/main.go
deleted file mode 100644
index 8bf666b2..00000000
--- a/internal/outcome/main.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package outcome
-
-import (
- "context"
- "log"
- "time"
- _ "unsafe" // for go:linkname
-
- "hakurei.app/hst"
- "hakurei.app/message"
-)
-
-// IsPollDescriptor reports whether fd is the descriptor being used by the poller.
-//
-// Made available here to determine and reject impossible fd.
-//
-//go:linkname IsPollDescriptor internal/poll.IsPollDescriptor
-func IsPollDescriptor(fd uintptr) bool
-
-// 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, fd int) {
- // avoids runtime internals or standard streams
- if fd >= 0 {
- if IsPollDescriptor(uintptr(fd)) || fd < 3 {
- log.Fatalf("invalid identifier fd %d", fd)
- }
- }
-
- var id hst.ID
- if err := hst.NewInstanceID(&id); err != nil {
- log.Fatal(err.Error())
- }
-
- k := outcome{syscallDispatcher: direct{msg}}
-
- finaliseTime := time.Now()
- if err := k.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)
-
- k.main(msg, fd)
- panic("unreachable")
-}