1
0
mirror of https://github.com/schollz/croc.git synced 2024-11-23 15:44:16 +03:00
croc/main.go

56 lines
1.1 KiB
Go
Raw Normal View History

2018-06-28 16:38:07 +03:00
package main
2019-06-20 17:10:37 +03:00
//go:generate go run src/install/updateversion.go
2019-06-20 17:10:37 +03:00
//go:generate git commit -am "bump $VERSION"
//go:generate git tag -af v$VERSION -m "v$VERSION"
2018-06-28 16:38:07 +03:00
2018-10-17 16:39:02 +03:00
import (
"log"
2024-09-04 04:27:19 +03:00
"os"
"os/signal"
"syscall"
2018-06-30 19:47:27 +03:00
2024-05-23 16:25:53 +03:00
"github.com/schollz/croc/v10/src/cli"
"github.com/schollz/croc/v10/src/utils"
2019-04-30 02:09:37 +03:00
)
2018-06-30 19:47:27 +03:00
2018-09-22 06:51:43 +03:00
func main() {
2019-11-11 22:26:32 +03:00
// "github.com/pkg/profile"
// go func() {
// for {
// f, err := os.Create("croc.pprof")
// if err != nil {
// panic(err)
// }
// runtime.GC() // get up-to-date statistics
// if err := pprof.WriteHeapProfile(f); err != nil {
// panic(err)
// }
// f.Close()
// time.Sleep(3 * time.Second)
// fmt.Println("wrote profile")
// }
// }()
2024-09-04 04:27:19 +03:00
// Create a channel to receive OS signals
sigs := make(chan os.Signal, 1)
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
go func() {
if err := cli.Run(); err != nil {
log.Fatalln(err)
}
}()
// Wait for a termination signal
sig := <-sigs
log.Println("Received signal:", sig)
// Perform any necessary cleanup here
log.Println("Performing cleanup...")
utils.CleanupTempData()
2024-09-04 04:27:19 +03:00
// Exit the program gracefully
os.Exit(0)
2018-09-22 08:25:01 +03:00
}