add backwards compatible mount-process delete

pull/12711/head
Steven Powell 2021-10-14 16:01:59 -07:00
parent ad47329d17
commit 9a89855997
1 changed files with 16 additions and 1 deletions

View File

@ -518,7 +518,22 @@ func deleteMachineDirectories(cc *config.ClusterConfig) {
// killMountProcess kills the mount process, if it is running
func killMountProcess() error {
profile := viper.GetString("profile")
pidPath := filepath.Join(localpath.Profile(profile), constants.MountProcessFileName)
paths := []string{
localpath.MiniPath(), // legacy mount-process path for backwards compatibility
filepath.Join(localpath.Profile(profile)),
}
for _, path := range paths {
if err := killProcess(path); err != nil {
return err
}
}
return nil
}
func killProcess(path string) error {
pidPath := filepath.Join(path, constants.MountProcessFileName)
if _, err := os.Stat(pidPath); os.IsNotExist(err) {
return nil
}