Catch os... errors
This commit is contained in:
parent
5ab85372da
commit
4ff0db0246
14 changed files with 123 additions and 29 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue