Permalink
Browse files

Fix a bug where gonit can't read a pidfile with a newline.

Change-Id: If615f05969038ba336704670614b9a3854b445f7
  • Loading branch information...
lisbakke committed Sep 20, 2012
1 parent cb0d39f commit 5223264462a6efa8cabd7a6fd3536400bc74b290
Showing with 2 additions and 1 deletion.
  1. +2 −1 process.go
View
@@ -185,7 +185,8 @@ func (p *Process) IsRunning() bool {
func ReadPidFile(path string) (int, error) {
pid, err := ioutil.ReadFile(path)
if err == nil {
- return strconv.Atoi(string(pid))
+ pidString := strings.TrimSpace(string(pid))
+ return strconv.Atoi(pidString)
}
return 0, err
}

0 comments on commit 5223264

Please sign in to comment.