File tree 2 files changed +3
-8
lines changed
2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -6,16 +6,11 @@ pidfile package
6
6
````
7
7
import "github.com/h2object/pidfile"
8
8
9
- // create pid file
9
+ // insert into the process begin
10
10
pid, err := pidfile.New("h2object.pid")
11
11
if err != nil {
12
12
//....
13
13
}
14
-
15
-
16
- // stop pid process
17
- if err := pid.Kill(); err != nil {
18
- //....
19
- }
14
+ defer pid.Kill()
20
15
21
16
````
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ func checkPidFileAlreadyExists(path string) error {
34
34
if pidString , err := ioutil .ReadFile (path ); err == nil {
35
35
if pid , err := strconv .Atoi (string (pidString )); err == nil {
36
36
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" )
38
38
}
39
39
}
40
40
}
You can’t perform that action at this time.
0 commit comments