From 6bc5be7e5a2334274adf2945ad6d29d063a7086b Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Wed, 23 Oct 2024 21:46:21 +0900 Subject: internal: wrap calls to os standard library functions This change helps tests stub out and simulate OS behaviour during the sealing process. This also removes dependency on XDG_RUNTIME_DIR as the internal.System implementation provided to App provides a compat directory inside the tmpdir-based share when XDG_RUNTIME_DIR is unavailable. Signed-off-by: Ophestra Umiker --- internal/app/launch.machinectl.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'internal/app/launch.machinectl.go') diff --git a/internal/app/launch.machinectl.go b/internal/app/launch.machinectl.go index 32f06740..c1d26101 100644 --- a/internal/app/launch.machinectl.go +++ b/internal/app/launch.machinectl.go @@ -1,7 +1,6 @@ package app import ( - "os/exec" "strings" "git.ophivana.moe/security/fortify/internal/fmsg" @@ -31,7 +30,7 @@ func (a *app) commandBuilderMachineCtl(shimEnv string) (args []string) { args = append(args, "--", ".host") // /bin/sh -c - if sh, err := exec.LookPath("sh"); err != nil { + if sh, err := a.os.LookPath("sh"); err != nil { // hardcode /bin/sh path since it exists more often than not args = append(args, "/bin/sh", "-c") } else { -- cgit v1.3.1