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
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.

https://codereview.appspot.com/5684066/

To post a comment you must log in.
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

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
=== <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.ReadFile(srv.path("pid.txt"))
   if err != nil {
- if err, ok := err.(*os.PathError); ok && err.Err == os.ENOENT {
- 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.SyscallError); ok && e.Err == os.ECHILD {
+ 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

Revision history for this message
Roger Peppe (rogpeppe) wrote :

On 2012/02/22 19:08:58, niemeyer wrote:
> Please take a look.

LGTM

https://codereview.appspot.com/5684066/

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

*** Submitted:

Fix after latest changes in Go's tip.

R=rog
CC=
https://codereview.appspot.com/5684066

https://codereview.appspot.com/5684066/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches