forked from security/hakurei
shim: user switcher process management struct
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:
13
main.go
13
main.go
@@ -53,15 +53,18 @@ func main() {
|
||||
tryState()
|
||||
|
||||
// invoke app
|
||||
r := 1
|
||||
a, err := app.New(os)
|
||||
if err != nil {
|
||||
fmsg.Fatalf("cannot create app: %s\n", err)
|
||||
} else if err = a.Seal(loadConfig()); err != nil {
|
||||
logBaseError(err, "fortify: cannot seal app:")
|
||||
logBaseError(err, "cannot seal app:")
|
||||
} else if err = a.Start(); err != nil {
|
||||
logBaseError(err, "fortify: cannot start app:")
|
||||
} else if r, err = a.Wait(); err != nil {
|
||||
logBaseError(err, "cannot start app:")
|
||||
}
|
||||
|
||||
var r int
|
||||
// wait must be called regardless of result of start
|
||||
if r, err = a.Wait(); err != nil {
|
||||
if r < 1 {
|
||||
r = 1
|
||||
}
|
||||
@@ -70,5 +73,5 @@ func main() {
|
||||
if err = a.WaitErr(); err != nil {
|
||||
fmsg.Println("inner wait failed:", err)
|
||||
}
|
||||
os.Exit(r)
|
||||
fmsg.Exit(r)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user