MCPcopy
hub / github.com/lxc/incus / killProxyProc

Method killProxyProc

internal/server/device/proxy.go:744–762  ·  view source on GitHub ↗
(pidPath string)

Source from the content-addressed store, hash-verified

742}
743
744func (d *proxy) killProxyProc(pidPath string) error {
745 // If the pid file doesn't exist, there is no process to kill.
746 if !util.PathExists(pidPath) {
747 return nil
748 }
749
750 p, err := subprocess.ImportProcess(pidPath)
751 if err != nil {
752 return fmt.Errorf("Could not read pid file: %s", err)
753 }
754
755 err = p.Stop()
756 if err != nil && !errors.Is(err, subprocess.ErrNotRunning) {
757 return fmt.Errorf("Unable to kill forkproxy: %s", err)
758 }
759
760 _ = os.Remove(pidPath)
761 return nil
762}
763
764// Remove cleans up the device when it is removed from an instance.
765func (d *proxy) Remove(cleanupDependencies bool) error {

Callers 1

StopMethod · 0.95

Calls 5

PathExistsFunction · 0.92
ImportProcessFunction · 0.92
ErrorfMethod · 0.80
StopMethod · 0.65
RemoveMethod · 0.65

Tested by

no test coverage detected