Skip to content

Commit 7513962

Browse files
committed
Close config last
1 parent dbef8d2 commit 7513962

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

cmd/state-remote-installer/main.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,18 @@ func main() {
5959
exitCode = 1
6060
}
6161

62-
if err := cfg.Close(); err != nil {
63-
logging.Error("Failed to close config: %w", err)
62+
ev := []func(){rollbar.Wait, logging.Close}
63+
if an != nil {
64+
ev = append(ev, an.Wait)
6465
}
65-
66-
if err := events.WaitForEvents(5*time.Second, rollbar.Wait, an.Wait, logging.Close); err != nil {
66+
if err := events.WaitForEvents(5*time.Second, ev...); err != nil {
6767
logging.Warning("state-remote-installer failed to wait for events: %v", err)
6868
}
69+
70+
if cfg != nil {
71+
events.Close("config", cfg.Close)
72+
}
73+
6974
os.Exit(exitCode)
7075
}()
7176

0 commit comments

Comments
 (0)