2018-06-28 16:38:07 +03:00
|
|
|
package main
|
2019-06-20 17:10:37 +03:00
|
|
|
|
2019-05-02 23:14:09 +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 (
|
2021-02-01 12:48:34 +03:00
|
|
|
"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"
|
2024-09-04 04:56:46 +03:00
|
|
|
"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"
|
2020-03-27 19:32:41 +03:00
|
|
|
// 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...")
|
2024-09-04 04:56:46 +03:00
|
|
|
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
|
|
|
}
|