recover on ssh help message(template), (-) this happens if server machine has an old version of golang

This commit is contained in:
Gerasimos Maropoulos 2016-09-15 19:38:00 +03:00
parent 8bd94875d2
commit 0dffe0dfa9

8
ssh.go
View File

@ -486,7 +486,13 @@ var standardCommands = Commands{Command{Name: "help", Description: "Opens up the
func (s *SSHServer) writeHelp(wr io.Writer) { func (s *SSHServer) writeHelp(wr io.Writer) {
port := parsePort(s.Host) port := parsePort(s.Host)
hostname := parseHostname(s.Host) hostname := parseHostname(s.Host)
defer func() {
if r := recover(); r != nil {
// means that user-dev has old version of Go Programming Language in her/his machine, so print a message to the server terminal
// which will help the dev, NOT the client
s.logf("[IRIS SSH] Help message is disabled, please install Go Programming Language, at least version 1.7: https://golang.org/dl/")
}
}()
data := map[string]interface{}{ data := map[string]interface{}{
"Hostname": hostname, "PortDeclaration": "-p " + strconv.Itoa(port), "Hostname": hostname, "PortDeclaration": "-p " + strconv.Itoa(port),
"Commands": append(s.Commands, standardCommands...), "Commands": append(s.Commands, standardCommands...),