Skip to content

Commit c82da5c

Browse files
author
刘建平
committed
modify readme.md
1 parent 91a6c08 commit c82da5c

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

README.md

+2-7
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@ pidfile package
66
````
77
import "github.com/h2object/pidfile"
88
9-
// create pid file
9+
// insert into the process begin
1010
pid, err := pidfile.New("h2object.pid")
1111
if err != nil {
1212
//....
1313
}
14-
15-
16-
// stop pid process
17-
if err := pid.Kill(); err != nil {
18-
//....
19-
}
14+
defer pid.Kill()
2015
2116
````

pidfile.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func checkPidFileAlreadyExists(path string) error {
3434
if pidString, err := ioutil.ReadFile(path); err == nil {
3535
if pid, err := strconv.Atoi(string(pidString)); err == nil {
3636
if _, err := os.Stat(filepath.Join("/proc", string(pid))); err == nil {
37-
return fmt.Errorf("pid file found, ensure docker is not running or delete %s", path)
37+
return fmt.Errorf("pid process is running")
3838
}
3939
}
4040
}

0 commit comments

Comments
 (0)