diff options
author | Matthias Loibl <mail@matthiasloibl.com> | 2017-01-17 06:58:58 +0100 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-01-17 13:58:58 +0800 |
commit | d1006150fb3a82a8dd6e418578dc44474191bfd0 (patch) | |
tree | 99d13e24a1be0d118686106c1f6bbbe4dbaf6793 /models/ssh_key.go | |
parent | 6dd096b7f08799ff27d9e34356fb1163ca10f388 (diff) | |
download | gitea-d1006150fb3a82a8dd6e418578dc44474191bfd0.tar.gz gitea-d1006150fb3a82a8dd6e418578dc44474191bfd0.zip |
Refactor process package and introduce ProcessManager{} with tests (#75)
* Add a process.Manager singleton with process.GetManager()
* Use process.GetManager everywhere
* Fix godoc comments for process module
* Increment process counter id after locking the mutex
Diffstat (limited to 'models/ssh_key.go')
-rw-r--r-- | models/ssh_key.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/models/ssh_key.go b/models/ssh_key.go index cdb83b44e0..2f23026997 100644 --- a/models/ssh_key.go +++ b/models/ssh_key.go @@ -197,7 +197,7 @@ func SSHKeyGenParsePublicKey(key string) (string, int, error) { } defer os.Remove(tmpName) - stdout, stderr, err := process.Exec("SSHKeyGenParsePublicKey", setting.SSH.KeygenPath, "-lf", tmpName) + stdout, stderr, err := process.GetManager().Exec("SSHKeyGenParsePublicKey", setting.SSH.KeygenPath, "-lf", tmpName) if err != nil { return "", 0, fmt.Errorf("fail to parse public key: %s - %s", err, stderr) } @@ -382,7 +382,7 @@ func addKey(e Engine, key *PublicKey) (err error) { if err = ioutil.WriteFile(tmpPath, []byte(key.Content), 0644); err != nil { return err } - stdout, stderr, err := process.Exec("AddPublicKey", "ssh-keygen", "-lf", tmpPath) + stdout, stderr, err := process.GetManager().Exec("AddPublicKey", "ssh-keygen", "-lf", tmpPath) if err != nil { return fmt.Errorf("'ssh-keygen -lf %s' failed with error '%s': %s", tmpPath, err, stderr) } else if len(stdout) < 2 { |