You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
666 B

3 years ago
package main
import (
"os"
"os/exec"
"os/signal"
3 years ago
"github.com/zggsong/FileSync/config"
"github.com/zggsong/FileSync/server"
3 years ago
)
func main() {
go server.Run()
cmd := startBrowser()
chSingal := listen2Interrupt()
select {
case <-chSingal:
cmd.Process.Kill()
}
3 years ago
}
func startBrowser() *exec.Cmd {
chromePath := "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
cmd := exec.Command(chromePath, "--app=http://127.0.0.1:"+config.GetPort()+"/static/index.html")
cmd.Start()
return cmd
}
//监听中断信号
func listen2Interrupt() chan os.Signal {
chSignal := make(chan os.Signal, 1)
signal.Notify(chSignal, os.Interrupt)
return chSignal
}