add clean exit function
This commit is contained in:
parent
78ad86c594
commit
bd63efeeb7
6
main.go
6
main.go
|
@ -11,6 +11,7 @@ var config Config
|
|||
const sockfile = "/tmp/gopaper.sock"
|
||||
|
||||
func main() {
|
||||
|
||||
//TODO:kill existing processes
|
||||
|
||||
log.SetFlags(log.LstdFlags | log.Lshortfile)
|
||||
|
@ -60,3 +61,8 @@ func openLogfile() (*os.File, error) {
|
|||
}
|
||||
return f, nil
|
||||
}
|
||||
|
||||
func cleanExit(code int) {
|
||||
os.Remove(sockfile)
|
||||
os.Exit(code)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue