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.sudo.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'internal/app/launch.sudo.go') diff --git a/internal/app/launch.sudo.go b/internal/app/launch.sudo.go index 2df7be0f..e7a20672 100644 --- a/internal/app/launch.sudo.go +++ b/internal/app/launch.sudo.go @@ -1,8 +1,6 @@ package app import ( - "os" - "git.ophivana.moe/security/fortify/internal/fmsg" ) @@ -17,7 +15,7 @@ func (a *app) commandBuilderSudo(shimEnv string) (args []string) { args = append(args, "-Hiu", a.seal.sys.user.Username) // -A? - if _, ok := os.LookupEnv(sudoAskPass); ok { + if _, ok := a.os.LookupEnv(sudoAskPass); ok { fmsg.VPrintln(sudoAskPass, "set, adding askpass flag") args = append(args, "-A") } -- cgit v1.3.1