Fix (un)installation failure detection

This commit is contained in:
Eyal Posener 2020-01-03 14:42:15 +02:00
parent 3627b98439
commit bdd345f079
2 changed files with 9 additions and 10 deletions

6
go.sum
View File

@ -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=

View File

@ -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)
}
}