aboutsummaryrefslogtreecommitdiffstats
path: root/example
diff options
context:
space:
mode:
authorOx Cart2017-08-25 21:35:55 -0500
committerOx Cart2017-08-25 21:35:55 -0500
commit8f8563c338491437c0aaa758dd89e78955531fe9 (patch)
treeff9e8057b0410272ab12394155393f8b1cc95314 /example
parent351a4b68603fd5d5b013d9a680d8d97650510cd6 (diff)
downloadsystray-8f8563c338491437c0aaa758dd89e78955531fe9.tar.bz2
On windows, call on_exit at WM_QUERYENDSESSION
Diffstat (limited to 'example')
-rw-r--r--example/main.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/example/main.go b/example/main.go
index ee78d42..4b927da 100644
--- a/example/main.go
+++ b/example/main.go
@@ -2,7 +2,8 @@ package main
import (
"fmt"
- "os"
+ "io/ioutil"
+ "time"
"github.com/getlantern/systray"
"github.com/getlantern/systray/example/icon"
@@ -10,16 +11,10 @@ import (
)
func main() {
- file, err := os.Create("out.txt")
- if err != nil {
- fmt.Println("Couldn't create out.txt")
- return
- }
- defer file.Close()
onExit := func() {
fmt.Println("Starting onExit")
- file.Write([]byte("On Exit...\n"))
- file.Sync()
+ now := time.Now()
+ ioutil.WriteFile(fmt.Sprintf(`on_exit_%d.txt`, now.UnixNano()), []byte(now.String()), 0644)
fmt.Println("Finished onExit")
}
// Should be called at the very beginning of main().