aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-10-27 00:46:15 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-10-27 00:46:15 +0900
commit1d6ea8120552665072f5044a004128e7dbbf3a64 (patch)
tree1ea0b9d2f687909cdd5fab3fbf50c473f942e7cf /main.go
parentae1a102882103221ef842176dfd8cb1090d5f591 (diff)
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>
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/main.go b/main.go
index 3883eff4..7bb7ffe6 100644
--- a/main.go
+++ b/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)
}