sys: wrap log methods
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
bf95127332
commit
ffaa12b9d8
@ -3,6 +3,7 @@ package app_test
|
||||
import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"log"
|
||||
"os/user"
|
||||
"strconv"
|
||||
|
||||
@ -23,6 +24,9 @@ func (s *stubNixOS) Exit(code int) { panic("called ex
|
||||
func (s *stubNixOS) EvalSymlinks(path string) (string, error) { return path, nil }
|
||||
func (s *stubNixOS) Uid(aid int) (int, error) { return 1000000 + 0*10000 + aid, nil }
|
||||
|
||||
func (s *stubNixOS) Println(v ...any) { log.Println(v...) }
|
||||
func (s *stubNixOS) Printf(format string, v ...any) { log.Printf(format, v...) }
|
||||
|
||||
func (s *stubNixOS) LookupEnv(key string) (string, bool) {
|
||||
switch key {
|
||||
case "SHELL":
|
||||
|
@ -34,6 +34,9 @@ type State interface {
|
||||
// Exit provides [os.Exit].
|
||||
Exit(code int)
|
||||
|
||||
Println(v ...any)
|
||||
Printf(format string, v ...any)
|
||||
|
||||
// Paths returns a populated [Paths] struct.
|
||||
Paths() Paths
|
||||
// Uid invokes fsu and returns target uid.
|
||||
|
@ -41,6 +41,8 @@ func (s *Std) Stat(name string) (fs.FileInfo, error) { return os.Stat(nam
|
||||
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) { fmsg.Verbose(v...) }
|
||||
func (s *Std) Printf(format string, v ...any) { fmsg.Verbosef(format, v...) }
|
||||
|
||||
const xdgRuntimeDir = "XDG_RUNTIME_DIR"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user