Catch os... errors
This commit is contained in:

committed by
Kim "BKC" Carlbäcker

parent
5ab85372da
commit
4ff0db0246
@ -162,7 +162,12 @@ func Listen(port int) {
|
||||
|
||||
keyPath := filepath.Join(setting.AppDataPath, "ssh/gogs.rsa")
|
||||
if !com.IsExist(keyPath) {
|
||||
os.MkdirAll(filepath.Dir(keyPath), os.ModePerm)
|
||||
filePath := filepath.Dir(keyPath)
|
||||
|
||||
if err := os.MkdirAll(filePath, os.ModePerm); err != nil {
|
||||
log.Error(4, "Fail to create dir %s: %v", filePath, err)
|
||||
}
|
||||
|
||||
_, stderr, err := com.ExecCmd("ssh-keygen", "-f", keyPath, "-t", "rsa", "-N", "")
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Fail to generate private key: %v - %s", err, stderr))
|
||||
|
Reference in New Issue
Block a user