aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/dispatcher.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-10-10 20:12:05 +0900
committerOphestra <cat@gensokyo.uk>2025-10-10 20:15:58 +0900
commit24de7c50a0ea7000c3a49c56b91db9aa72abdd28 (patch)
treeaa43fa13b27a88ec153a7b83550c45c7fd1db76e /internal/app/dispatcher.go
parentf6dd9dab6a91c8c39ea2a5afbca50e427e6a21ba (diff)
internal/app: relocate state initialisation
This is useful for testing. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/dispatcher.go')
-rw-r--r--internal/app/dispatcher.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/app/dispatcher.go b/internal/app/dispatcher.go
index 6e00a9b7..d56278a0 100644
--- a/internal/app/dispatcher.go
+++ b/internal/app/dispatcher.go
@@ -29,6 +29,8 @@ type syscallDispatcher interface {
// just synchronising access is not enough, as this is for test instrumentation.
new(f func(k syscallDispatcher))
+ // getpid provides [os.Getpid].
+ getpid() int
// getuid provides [os.Getuid].
getuid() int
// getgid provides [os.Getgid].
@@ -70,6 +72,7 @@ type direct struct{}
func (k direct) new(f func(k syscallDispatcher)) { go f(k) }
+func (direct) getpid() int { return os.Getpid() }
func (direct) getuid() int { return os.Getuid() }
func (direct) getgid() int { return os.Getgid() }
func (direct) lookupEnv(key string) (string, bool) { return os.LookupEnv(key) }