aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-19 21:05:48 +0900
committerOphestra <cat@gensokyo.uk>2025-02-19 21:12:11 +0900
commit3c80fd2b0f907af7b179e9e307304c0fa52994a0 (patch)
treef52e8ed67f94f4ff8c423cd1e8b06fef82918c93 /main.go
parentef81828e0c1ce6277e0b124f6062eab564dfeceb (diff)
app: defer system.I revert
Just returning an error after a successful call of commit will leave garbage behind with no way for the caller to clean them. This change ensures revert is always called after successful commit with at least per-process state enabled. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'main.go')
-rw-r--r--main.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/main.go b/main.go
index c1aee941..7896a199 100644
--- a/main.go
+++ b/main.go
@@ -334,7 +334,7 @@ func runApp(config *fst.Config) {
fmsg.PrintBaseError(err, "cannot seal app:")
internal.Exit(1)
} else if err = a.Run(ctx, rs); err != nil {
- if !rs.Start {
+ if rs.Time == nil {
fmsg.PrintBaseError(err, "cannot start app:")
} else {
logWaitError(err)
@@ -344,6 +344,12 @@ func runApp(config *fst.Config) {
rs.ExitCode = 126
}
}
+ if rs.RevertErr != nil {
+ fmsg.PrintBaseError(rs.RevertErr, "generic error returned during cleanup:")
+ if rs.ExitCode == 0 {
+ rs.ExitCode = 128
+ }
+ }
if rs.WaitErr != nil {
log.Println("inner wait failed:", rs.WaitErr)
}