Skip to content

Commit

Permalink
Try to stop running tray when version check fails
Browse files Browse the repository at this point in the history
Move kill running tray process to version fix function
it should have been here all along, we can only expect a running tray
when there is one available, and only when it is available and the
versions don't match we need to update the version in which case we'll
have to stop the running tray, in normal case when fixTrayBinaryExists
is called, it'll most probably not have a running tray, as that binary
doesn't exist yet
  • Loading branch information
anjannath committed Jun 22, 2020
1 parent 21ee90f commit 97b193a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/crc/preflight/preflight_checks_tray_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,6 @@ func fixTrayBinaryExists() error {
return fmt.Errorf("Cannot uncompress '%s': %v", archivePath, err)
}

// If a tray is already running kill it
if err := checkTrayRunning(); err == nil {
cmd := `Stop-Process -Name "tray-windows"`
if _, _, err := powershell.Execute(cmd); err != nil {
logging.Debugf("Failed to kill running tray: %v", err)
}
}
return nil
}

Expand All @@ -143,6 +136,13 @@ func checkTrayBinaryVersion() error {
}

func fixTrayBinaryVersion() error {
// If a tray is already running kill it
if err := checkTrayRunning(); err == nil {
cmd := `Stop-Process -Name "tray-windows"`
if _, _, err := powershell.Execute(cmd); err != nil {
logging.Debugf("Failed to kill running tray: %v", err)
}
}
return fixTrayBinaryExists()
}

Expand Down

0 comments on commit 97b193a

Please sign in to comment.