git-lfs/git-lfs.go
brian m. carlson 51fdfc258f
Run go generate only on Windows
On Windows, we want to run goversioninfo, which embeds certain version
information into Windows binaries. However, despite compiling and
running on non-Windows systems, it isn't very useful there. Move the
go:generate comment into a separate file that's only built on Windows.
2019-01-15 22:17:53 +00:00

37 lines
549 B
Go

package main
import (
"fmt"
"os"
"os/signal"
"sync"
"syscall"
"github.com/git-lfs/git-lfs/commands"
)
func main() {
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, os.Kill)
var once sync.Once
go func() {
for {
sig := <-c
once.Do(commands.Cleanup)
fmt.Fprintf(os.Stderr, "\nExiting because of %q signal.\n", sig)
exitCode := 1
if sysSig, ok := sig.(syscall.Signal); ok {
exitCode = int(sysSig)
}
os.Exit(exitCode + 128)
}
}()
code := commands.Run()
once.Do(commands.Cleanup)
os.Exit(code)
}