git-lfs/git-lfs.go

38 lines
586 B
Go
Raw Normal View History

2013-09-23 00:34:53 +00:00
package main
import (
"fmt"
2015-10-21 21:47:46 +00:00
"os"
"os/signal"
"sync"
"syscall"
2015-10-21 21:47:46 +00:00
2015-03-19 19:30:55 +00:00
"github.com/github/git-lfs/commands"
"github.com/github/git-lfs/lfs"
2013-09-23 00:34:53 +00:00
)
func main() {
2015-10-21 21:47:46 +00:00
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, os.Kill)
2015-10-21 21:47:46 +00:00
var once sync.Once
go func() {
for {
sig := <-c
2015-10-21 21:47:46 +00:00
once.Do(lfs.ClearTempObjects)
fmt.Fprintf(os.Stderr, "\nExiting because of %q signal.\n", sig)
2015-10-22 16:03:27 +00:00
exitCode := 1
if sysSig, ok := sig.(syscall.Signal); ok {
exitCode = int(sysSig)
}
os.Exit(exitCode + 128)
2015-10-21 21:47:46 +00:00
}
}()
commands.Run()
lfs.LogHttpStats()
2015-10-21 21:47:46 +00:00
once.Do(lfs.ClearTempObjects)
2013-09-23 00:34:53 +00:00
}