File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change 44package usernet
55
66import (
7- "bytes"
87 "context"
98 "encoding/json"
109 "errors"
@@ -21,6 +20,7 @@ import (
2120 "github.com/lima-vm/lima/v2/pkg/executil"
2221 "github.com/lima-vm/lima/v2/pkg/limatype/dirnames"
2322 "github.com/lima-vm/lima/v2/pkg/lockutil"
23+ "github.com/lima-vm/lima/v2/pkg/osutil"
2424 "github.com/lima-vm/lima/v2/pkg/store"
2525)
2626
@@ -143,14 +143,9 @@ func Stop(ctx context.Context, name string) error {
143143 return err
144144 }
145145
146- var stdout , stderr bytes.Buffer
147- cmd := exec .CommandContext (ctx , "/usr/bin/pkill" , "-F" , pidFile )
148- cmd .Stdout = & stdout
149- cmd .Stderr = & stderr
150- logrus .Debugf ("Running: %v" , cmd .Args )
151- if err := cmd .Run (); err != nil {
152- return fmt .Errorf ("failed to run %v: stdout=%q, stderr=%q: %w" ,
153- cmd .Args , stdout .String (), stderr .String (), err )
146+ if err := osutil .SysKill (pid , osutil .SigKill ); err != nil {
147+ logrus .Error (err )
148+ return fmt .Errorf ("failed to kill process with pid %d: %w" , pid , err )
154149 }
155150 }
156151
You can’t perform that action at this time.
0 commit comments