Fix (un)installation failure detection
This commit is contained in:
parent
3627b98439
commit
bdd345f079
6
go.sum
6
go.sum
|
@ -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/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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
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 h1:nSuXW5ZdmFnQIueLB2s0qvs4oNsUloM1Zydzh75v42w=
|
||||||
github.com/posener/script v1.0.4/go.mod h1:Rg3ijooqulo05aGLyGsHoLmIOUzHUVK19WVgrYBPU/E=
|
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=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
|
|
@ -26,16 +26,21 @@ func Run(name string, uninstall, yes bool, out io.Writer, in io.Reader) {
|
||||||
switch strings.ToLower(answer) {
|
switch strings.ToLower(answer) {
|
||||||
case "y", "yes":
|
case "y", "yes":
|
||||||
default:
|
default:
|
||||||
fmt.Fprintf(out, "Cancelling...")
|
fmt.Fprintf(out, "Cancelling...\n")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Fprintf(out, action+"ing...")
|
fmt.Fprintf(out, action+"ing...\n")
|
||||||
|
|
||||||
|
var err error
|
||||||
if uninstall {
|
if uninstall {
|
||||||
Uninstall(name)
|
err = Uninstall(name)
|
||||||
} else {
|
} else {
|
||||||
Install(name)
|
err = Install(name)
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(out, "%s failed: %s\n", action, err)
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue