Merge lp://staging/~niemeyer/gozk/is-not-exist into lp://staging/gozk/zookeeper
Proposed by
Gustavo Niemeyer
Status: | Merged |
---|---|
Merged at revision: | 30 |
Proposed branch: | lp://staging/~niemeyer/gozk/is-not-exist |
Merge into: | lp://staging/gozk/zookeeper |
Diff against target: |
29 lines (+4/-5) 1 file modified
runserver.go (+4/-5) |
To merge this branch: | bzr merge lp://staging/~niemeyer/gozk/is-not-exist |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
The Go Language Gophers | Pending | ||
Review via email: mp+94257@code.staging.launchpad.net |
Description of the change
Fix after latest changes in Go's tip.
To post a comment you must log in.
Reviewers: mp+94257_ code.launchpad. net,
Message:
Please take a look.
Description:
https:/ /code.launchpad .net/~niemeyer/ gozk/is- not-exist/ +merge/ 94257
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/5684066/
Affected files:
M runserver.go
Index: runserver.go ReadFile( srv.path( "pid.txt" )) PathError) ; ok && err.Err == os.ENOENT { SyscallError) ; ok && e.Err == os.ECHILD {
=== <email address hidden> >
<email address hidden>
=== modified file 'runserver.go'
--- runserver.go 2012-02-15 13:14:05 +0000
+++ runserver.go 2012-02-22 18:56:23 +0000
@@ -24,8 +24,8 @@
func (srv *Server) Process() (*os.Process, error) {
data, err := ioutil.
if err != nil {
- if err, ok := err.(*os.
- return nil, NotRunning
+ if os.IsNotExist(err) {
+ err = NotRunning
}
return nil, err
}
@@ -131,12 +131,11 @@
if err := p.Kill(); err != nil {
return fmt.Errorf("cannot kill server process: %v", err)
}
- // ignore the error returned from Wait because there's little
+ // Ignore the error returned from Wait because there's little
// we can do about it - it either means that the process has just exited
// anyway or that we can't wait for it for some other reason,
// for example because it was originally started by some other process.
- _, err = p.Wait(0)
- if e, ok := err.(*os.
+ if _, err := p.Wait(); err != nil {
// If we can't wait for the server, it's possible that it was running
// but not as a child of this process, so the only thing we can do
// is to poll until it exits. If the process has taken longer than