aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/linux
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-11-04 22:55:46 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-11-04 22:55:46 +0900
commit69cc64ef56c4b46954514d7ef1b93b3861443255 (patch)
treee7a334465e270450b39191697d4561bb21076559 /internal/linux
parentfc25ac2523c512c67d73db5bbbd47224dc0b2001 (diff)
linux: provide access to stdout
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/linux')
-rw-r--r--internal/linux/interface.go3
-rw-r--r--internal/linux/std.go2
2 files changed, 5 insertions, 0 deletions
diff --git a/internal/linux/interface.go b/internal/linux/interface.go
index cf984a32..36f61b1a 100644
--- a/internal/linux/interface.go
+++ b/internal/linux/interface.go
@@ -1,6 +1,7 @@
package linux
import (
+ "io"
"io/fs"
"os/user"
"path"
@@ -31,6 +32,8 @@ type System interface {
Open(name string) (fs.File, error)
// Exit provides [os.Exit].
Exit(code int)
+ // Stdout provides [os.Stdout].
+ Stdout() io.Writer
// FshimPath returns an absolute path to the fshim binary.
FshimPath() string
diff --git a/internal/linux/std.go b/internal/linux/std.go
index 704ba162..e0a0994c 100644
--- a/internal/linux/std.go
+++ b/internal/linux/std.go
@@ -2,6 +2,7 @@ package linux
import (
"errors"
+ "io"
"io/fs"
"os"
"os/exec"
@@ -34,6 +35,7 @@ func (s *Std) ReadDir(name string) ([]os.DirEntry, error) { return os.ReadDir(na
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) Exit(code int) { fmsg.Exit(code) }
+func (s *Std) Stdout() io.Writer { return os.Stdout }
const xdgRuntimeDir = "XDG_RUNTIME_DIR"