Skip to content

chengxuncc/shutdownhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Windows Shutdown Hook

Windows shutdown hook implement in pure Go.

Install

go get -u github.com/chengxuncc/shutdownhook

Example

package main

import (
	"fmt"
	"os"
	"time"

	"github.com/chengxuncc/shutdownhook"
)

func main() {
	f, err := os.Create("shutdown.log")
	if err != nil {
		panic(err)
	}
	err = shutdownhook.New(func() {
		fmt.Fprintf(f, "%s shutdown\n", time.Now())
		f.Close()
	})
	if err != nil {
		panic(err)
	}
}

About

Windows shutdown hook implement in pure Go.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages