github.com/angenalZZZ/gofunc@v0.0.0-20210507121333-48ff1be3917b/cmd/jsrun/main.go (about)

     1  ///go get github.com/angenalZZZ/gofunc/cmd/jsrun
     2  ///go build -ldflags "-s -w" -o A:/test/cmd/jsrun/jsrun.exe ./cmd/jsrun
     3  ///start A:/test/cmd/jsrun/jsrun.exe jsrun.js
     4  
     5  package main
     6  
     7  import (
     8  	"flag"
     9  	"os"
    10  	"runtime"
    11  	"syscall"
    12  
    13  	"github.com/angenalZZZ/gofunc/f"
    14  )
    15  
    16  func main() {
    17  	// Your Arguments.
    18  	initArgs()
    19  	if len(os.Args) < 2 {
    20  		flag.Usage()
    21  		return
    22  	}
    23  
    24  	defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(runtime.NumCPU()))
    25  
    26  	// Check Arguments And Init Config.
    27  	checkArgs()
    28  
    29  	// New Client Connect.
    30  	natClientConnect()
    31  
    32  	// Run script.
    33  	run()
    34  
    35  	// Pass the signals you want to end your application.
    36  	death := f.NewDeath(syscall.SIGINT, syscall.SIGTERM)
    37  	// When you want to block for shutdown signals.
    38  	death.WaitForDeathWithFunc(func() {})
    39  }