exit non-zero on error

master
Dingjun 8 years ago
parent bce4a81a51
commit fcb4b307c6

@ -260,21 +260,33 @@ func main() {
} }
} }
hasErr := false
if !cfg.NotRunCmd { if !cfg.NotRunCmd {
if cmd != "" { if cmd != "" {
if d, err := client.RunCmd(cmd); err != nil { if d, err := client.RunCmd(cmd); err != nil {
log.Println(err) log.Println(err)
hasErr = true
} else { } else {
//log.Printf("%s", string(d)) //log.Printf("%s", string(d))
fmt.Printf("%s", string(d)) fmt.Printf("%s", string(d))
} }
} else { } else {
if err := client.Shell(); err != nil { if err := client.Shell(); err != nil {
hasErr = true
log.Println(err) log.Println(err)
} }
} }
} }
client.Run()
if err := client.Run(); err != nil {
log.Println(err)
hasErr = true
}
if hasErr {
os.Exit(1)
}
} }
func parseForwardAddr(s string) []string { func parseForwardAddr(s string) []string {

Loading…
Cancel
Save