aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/sys/std.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-09-25 13:46:21 +0900
committerOphestra <cat@gensokyo.uk>2025-09-25 13:51:54 +0900
commitae2df2c450dd655b93a950124b6ab16e2b4d967b (patch)
tree849ab40049228e17891351d97097f8c9d0e18c10 /internal/sys/std.go
parent6e3f34f2ecfe0f3cd024a6e73bf6560080feac53 (diff)
internal: remove sys package
This package is replaced by container/stub. Remove and replace it with unexported implementation for the upcoming test suite rewrite. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/sys/std.go')
-rw-r--r--internal/sys/std.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/internal/sys/std.go b/internal/sys/std.go
deleted file mode 100644
index 11334c72..00000000
--- a/internal/sys/std.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package sys
-
-import (
- "io/fs"
- "os"
- "os/exec"
- "os/user"
- "path/filepath"
- "sync"
-
- "hakurei.app/container"
- "hakurei.app/hst"
- "hakurei.app/internal"
- "hakurei.app/internal/hlog"
-)
-
-// Std implements System using the standard library.
-type Std struct {
- paths hst.Paths
- pathsOnce sync.Once
- Hsu
-}
-
-func (s *Std) Getuid() int { return os.Getuid() }
-func (s *Std) Getgid() int { return os.Getgid() }
-func (s *Std) LookupEnv(key string) (string, bool) { return os.LookupEnv(key) }
-func (s *Std) TempDir() string { return os.TempDir() }
-func (s *Std) LookPath(file string) (string, error) { return exec.LookPath(file) }
-func (s *Std) MustExecutable() string { return container.MustExecutable() }
-func (s *Std) LookupGroup(name string) (*user.Group, error) { return user.LookupGroup(name) }
-func (s *Std) ReadDir(name string) ([]os.DirEntry, error) { return os.ReadDir(name) }
-func (s *Std) Stat(name string) (fs.FileInfo, error) { return os.Stat(name) }
-func (s *Std) Open(name string) (fs.File, error) { return os.Open(name) }
-func (s *Std) EvalSymlinks(path string) (string, error) { return filepath.EvalSymlinks(path) }
-func (s *Std) Exit(code int) { internal.Exit(code) }
-func (s *Std) Println(v ...any) { hlog.Verbose(v...) }
-func (s *Std) Printf(format string, v ...any) { hlog.Verbosef(format, v...) }
-
-const xdgRuntimeDir = "XDG_RUNTIME_DIR"
-
-func (s *Std) Paths() hst.Paths {
- s.pathsOnce.Do(func() { CopyPaths(s, &s.paths, MustGetUserID(s)) })
- return s.paths
-}