From 583af5be6dd984fbd81fad54380921cce51dd7d5 Mon Sep 17 00:00:00 2001 From: David Gannon Date: Sun, 24 Mar 2024 16:07:28 +0000 Subject: [PATCH] Fixed the expectation that porter would already be installed (#3033) Signed-off-by: David --- CONTRIBUTORS.md | 1 + magefile.go | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 5bb4835f3..3381b2bf6 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -97,3 +97,4 @@ and we will add you. **All** contributors belong here. 💯 - [Ray Terrill](https://github.com/rayterrill) - [Kim Christensen](https://github.com/kichristensen) - [Shivam](https://github.com/Bharadwajshivam28) +- [David Gannon](https://github.com/dgannon991) \ No newline at end of file diff --git a/magefile.go b/magefile.go index 4e0811cdb..170272a45 100644 --- a/magefile.go +++ b/magefile.go @@ -645,8 +645,14 @@ func Install() { // Removing the file first clears the cache so that we don't run into "zsh: killed porter..." // See https://stackoverflow.com/questions/67378106/mac-m1-cping-binary-over-another-results-in-crash // See https://openradar.appspot.com/FB8914231 - mgx.Must(os.Remove(filepath.Join(porterHome, "porter"+xplat.FileExt()))) - mgx.Must(os.RemoveAll(filepath.Join(porterHome, "runtimes"))) + removeError := os.Remove(filepath.Join(porterHome, "porter"+xplat.FileExt())) + if !os.IsNotExist(removeError) { + mgx.Must(removeError) + } + removeError = os.RemoveAll(filepath.Join(porterHome, "runtimes")) + if !os.IsNotExist(removeError) { + mgx.Must(removeError) + } // Okay now it's safe to copy these files over mgx.Must(shx.Copy(filepath.Join("bin", "porter"+xplat.FileExt()), porterHome)) @@ -679,7 +685,6 @@ func Install() { // Removing the file first clears the cache so that we don't run into "zsh: killed MIXIN..." // See https://stackoverflow.com/questions/67378106/mac-m1-cping-binary-over-another-results-in-crash // See https://openradar.appspot.com/FB8914231 - // Copy the mixin client binary mgx.Must(shx.Copy(filepath.Join(srcDir, mixin+xplat.FileExt()), destDir))