From 74733b24c971a006c03e6d413a1ee71102c499d7 Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Thu, 5 Sep 2019 01:16:17 +0200 Subject: [bug] exit cleanly in osx two things happen differently in osx: - call to systray.Quit() halts the program (so if called directly, none of the deferred functions that we use for cleanup get to execute) - systray.Run() blocks (so after loop returns, the main run.Run() function did not get to receive the boolean through the finishedCh channel. proper shutdown is therefore fixed here by moving the call to systray.Quit() to a goroutine that executes when the initialize() function calls all the deferred functions. we need to revisit this in case we want to break the main select loop for a reson other than successfully terminating the program. --- pkg/standalone/main.go | 1 + 1 file changed, 1 insertion(+) (limited to 'pkg/standalone') diff --git a/pkg/standalone/main.go b/pkg/standalone/main.go index 6c267d6..4ac5776 100644 --- a/pkg/standalone/main.go +++ b/pkg/standalone/main.go @@ -68,6 +68,7 @@ func (b *Bitmask) GetStatusCh() <-chan string { // Close the connection to bitmask func (b *Bitmask) Close() { + log.Printf("Close: cleanup and vpn shutdown...") b.StopVPN() err := b.launch.close() if err != nil { -- cgit v1.2.3