error handling for client startup
This commit is contained in:
parent
679aaeebaa
commit
a96b0eb39b
|
@ -46,25 +46,30 @@ func runClient(cmd *cobra.Command, args []string) {
|
||||||
signal.Notify(osChan, os.Interrupt, os.Kill)
|
signal.Notify(osChan, os.Interrupt, os.Kill)
|
||||||
signal.Notify(osChan, syscall.SIGTERM)
|
signal.Notify(osChan, syscall.SIGTERM)
|
||||||
|
|
||||||
data.InitNC(osChan)
|
//fmt.Println("Running client ...")
|
||||||
// really important???
|
|
||||||
defer data.ExitNC()
|
|
||||||
|
|
||||||
fmt.Println("running client ...")
|
|
||||||
|
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
fmt.Println("Params: <NUMBER>")
|
fmt.Println("Usage: gosl", cmdClient.Use)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
id, err := strconv.Atoi(args[0])
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println("Error parsing client ID!")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
id, _ := strconv.Atoi(args[0])
|
|
||||||
|
|
||||||
con, err := net.Dial("tcp", ServerHost+":"+strconv.Itoa(ServerPort))
|
con, err := net.Dial("tcp", ServerHost+":"+strconv.Itoa(ServerPort))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("connect error:", err)
|
fmt.Println("CONNECT ERROR:", err)
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
defer con.Close()
|
defer con.Close()
|
||||||
register(con, id)
|
register(con, id)
|
||||||
|
|
||||||
|
data.InitNC(osChan)
|
||||||
|
// really important???
|
||||||
|
defer data.ExitNC()
|
||||||
|
|
||||||
go render()
|
go render()
|
||||||
run := true
|
run := true
|
||||||
for run {
|
for run {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user