diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-10-23 21:46:21 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-10-23 21:46:21 +0900 |
| commit | 6bc5be7e5a2334274adf2945ad6d29d063a7086b (patch) | |
| tree | d99223898a282b7ea40c41330b5748a3b5f2b310 /internal/app/app.go | |
| parent | e35c5fe3ed995d352c001bd7e35bd1214ca583da (diff) | |
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 <cat@ophivana.moe>
Diffstat (limited to 'internal/app/app.go')
| -rw-r--r-- | internal/app/app.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/app/app.go b/internal/app/app.go index 0055dd76..de2c461f 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -3,6 +3,8 @@ package app import ( "os/exec" "sync" + + "git.ophivana.moe/security/fortify/internal" ) type App interface { @@ -22,6 +24,8 @@ type App interface { type app struct { // application unique identifier id *ID + // operating system interface + os internal.System // underlying user switcher process cmd *exec.Cmd // shim setup abort reason and completion @@ -61,8 +65,9 @@ func (a *app) WaitErr() error { return a.waitErr } -func New() (App, error) { +func New(os internal.System) (App, error) { a := new(app) a.id = new(ID) + a.os = os return a, newAppID(a.id) } |
