diff options
| author | Eyal Posener <[email protected]> | 2020-01-03 14:42:15 +0200 |
|---|---|---|
| committer | Eyal Posener <[email protected]> | 2020-01-03 14:42:15 +0200 |
| commit | bdd345f07984e50450366cf726def3aa6d9c0b94 (patch) | |
| tree | 117afb90e2b9e851acc2e657df80919e080f9078 | |
| parent | 3627b9843923e3f366bb64a62d8adb0e6c469d83 (diff) | |
Fix (un)installation failure detection
| -rw-r--r-- | go.sum | 6 | ||||
| -rw-r--r-- | install/install.go | 13 |
2 files changed, 9 insertions, 10 deletions
@@ -8,12 +8,6 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/posener/script v1.0.0 h1:/mJqplLNbKgJBeOElS00vDU9CG5QaN+qwp/o+lQAoDc= -github.com/posener/script v1.0.0/go.mod h1:Rg3ijooqulo05aGLyGsHoLmIOUzHUVK19WVgrYBPU/E= -github.com/posener/script v1.0.1 h1:MIYijfAGNnzPcH9zTFi+s8iiCgSfv90uTM5QnaSbajA= -github.com/posener/script v1.0.1/go.mod h1:Rg3ijooqulo05aGLyGsHoLmIOUzHUVK19WVgrYBPU/E= -github.com/posener/script v1.0.3 h1:RZczCsHvWDaqWzRguPDbOyiGx63LqbXg/evCKqBQkec= -github.com/posener/script v1.0.3/go.mod h1:Rg3ijooqulo05aGLyGsHoLmIOUzHUVK19WVgrYBPU/E= github.com/posener/script v1.0.4 h1:nSuXW5ZdmFnQIueLB2s0qvs4oNsUloM1Zydzh75v42w= github.com/posener/script v1.0.4/go.mod h1:Rg3ijooqulo05aGLyGsHoLmIOUzHUVK19WVgrYBPU/E= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/install/install.go b/install/install.go index 1da52c3..1c995f3 100644 --- a/install/install.go +++ b/install/install.go @@ -26,16 +26,21 @@ func Run(name string, uninstall, yes bool, out io.Writer, in io.Reader) { switch strings.ToLower(answer) { case "y", "yes": default: - fmt.Fprintf(out, "Cancelling...") + fmt.Fprintf(out, "Cancelling...\n") return } } - fmt.Fprintf(out, action+"ing...") + fmt.Fprintf(out, action+"ing...\n") + var err error if uninstall { - Uninstall(name) + err = Uninstall(name) } else { - Install(name) + err = Install(name) + } + if err != nil { + fmt.Fprintf(out, "%s failed: %s\n", action, err) + os.Exit(1) } } |
