(pidPath string)
| 742 | } |
| 743 | |
| 744 | func (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. |
| 765 | func (d *proxy) Remove(cleanupDependencies bool) error { |
no test coverage detected