aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/sys/std.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-09-24 13:26:30 +0900
committerOphestra <cat@gensokyo.uk>2025-09-24 13:37:38 +0900
commitb99c63337df4068b36d7d8de2ae79fd274172977 (patch)
tree81d2453857b7d6328db6545f096181b771c24cc3 /internal/sys/std.go
parentf09133a224fabf2d16c7790654e39068cb59450f (diff)
internal/app: do not return from shim start
The whole RunState ugliness and the other horrendous error handling conditions for internal/app come from an old design proposal for maintaining all app containers under the same daemon process for a user. The proposal was ultimately rejected but the implementation remained. It is removed here to alleviate internal/app from much of its ugliness and unreadability. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/sys/std.go')
-rw-r--r--internal/sys/std.go28
1 files changed, 1 insertions, 27 deletions
diff --git a/internal/sys/std.go b/internal/sys/std.go
index 24b36fa2..11334c72 100644
--- a/internal/sys/std.go
+++ b/internal/sys/std.go
@@ -1,9 +1,7 @@
package sys
import (
- "errors"
"io/fs"
- "log"
"os"
"os/exec"
"os/user"
@@ -41,30 +39,6 @@ func (s *Std) Printf(format string, v ...any) { hlog.Verbosef(form
const xdgRuntimeDir = "XDG_RUNTIME_DIR"
func (s *Std) Paths() hst.Paths {
- s.pathsOnce.Do(func() {
- if userid, err := GetUserID(s); err != nil {
- // TODO(ophestra): this duplicates code in cmd/hakurei/command.go, keep this up to date until removal
- hlog.BeforeExit()
- const fallback = "cannot obtain user id from hsu:"
-
- // this indicates the error message has already reached stderr, outside the current process's control;
- // this is only reached when hsu fails for any reason, as a second error message following hsu is confusing
- if errors.Is(err, ErrHsuAccess) {
- hlog.Verbose("*"+fallback, err)
- os.Exit(1)
- return
- }
-
- m, ok := container.GetErrorMessage(err)
- if !ok {
- log.Fatalln(fallback, err)
- return
- }
-
- log.Fatal(m)
- } else {
- CopyPaths(s, &s.paths, userid)
- }
- })
+ s.pathsOnce.Do(func() { CopyPaths(s, &s.paths, MustGetUserID(s)) })
return s.paths
}