diff options
| author | Ox Cart | 2017-08-25 21:35:55 -0500 | 
|---|---|---|
| committer | Ox Cart | 2017-08-25 21:35:55 -0500 | 
| commit | 8f8563c338491437c0aaa758dd89e78955531fe9 (patch) | |
| tree | ff9e8057b0410272ab12394155393f8b1cc95314 /example/main.go | |
| parent | 351a4b68603fd5d5b013d9a680d8d97650510cd6 (diff) | |
| download | systray-8f8563c338491437c0aaa758dd89e78955531fe9.tar.bz2 | |
On windows, call on_exit at WM_QUERYENDSESSION
Diffstat (limited to 'example/main.go')
| -rw-r--r-- | example/main.go | 13 | 
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(). | 
