shim: user switcher process management struct
All checks were successful
test / test (push) Successful in 19s

This change moves all user switcher and shim management to the shim package and withholds output while shim is alive. This also eliminated all exit scenarios where revert is skipped.

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
2024-10-27 00:46:15 +09:00
parent ae1a102882
commit 1d6ea81205
7 changed files with 332 additions and 182 deletions

View File

@@ -1,10 +1,10 @@
package app
import (
"os/exec"
"sync"
"git.ophivana.moe/security/fortify/internal"
"git.ophivana.moe/security/fortify/internal/shim"
)
type App interface {
@@ -26,10 +26,8 @@ type app struct {
id *ID
// operating system interface
os internal.System
// underlying user switcher process
cmd *exec.Cmd
// shim setup abort reason and completion
abort chan error
// shim process manager
shim *shim.Shim
// child process related information
seal *appSeal
// error returned waiting for process
@@ -50,8 +48,8 @@ func (a *app) String() string {
a.lock.RLock()
defer a.lock.RUnlock()
if a.cmd != nil {
return a.cmd.String()
if a.shim != nil {
return a.shim.String()
}
if a.seal != nil {