Added exit code
This commit is contained in:
parent
ce4d829184
commit
2282560e7a
@ -110,5 +110,10 @@ func main() {
|
|||||||
Stdout: os.Stdout,
|
Stdout: os.Stdout,
|
||||||
Stderr: os.Stderr,
|
Stderr: os.Stderr,
|
||||||
}
|
}
|
||||||
cmd.Run()
|
err = cmd.Run()
|
||||||
|
if err != nil {
|
||||||
|
if exitError, ok := err.(*exec.ExitError); ok {
|
||||||
|
exitError.ExitCode()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,15 +13,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (*Version) latestMajorVersion() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*Version) latestMinorVersion() {
|
|
||||||
}
|
|
||||||
|
|
||||||
func (*Version) latestPatchVersion() {
|
|
||||||
}
|
|
||||||
|
|
||||||
type Version struct {
|
type Version struct {
|
||||||
Version SemVersion
|
Version SemVersion
|
||||||
availableVersions []SemVersion
|
availableVersions []SemVersion
|
||||||
@ -36,7 +27,6 @@ const (
|
|||||||
|
|
||||||
//getLatestMajorRelease() returns the latest major release from Version
|
//getLatestMajorRelease() returns the latest major release from Version
|
||||||
func (v *Version) getLatestMajorRelease() {
|
func (v *Version) getLatestMajorRelease() {
|
||||||
//todo clean up
|
|
||||||
for _, release := range v.availableVersions {
|
for _, release := range v.availableVersions {
|
||||||
if release.majorVersion == v.Version.majorVersion &&
|
if release.majorVersion == v.Version.majorVersion &&
|
||||||
release.minorVersion == v.Version.minorVersion &&
|
release.minorVersion == v.Version.minorVersion &&
|
||||||
@ -118,10 +108,6 @@ func (v *Version) InstallTerraformVersion() error {
|
|||||||
versionedFileName := homeDir + versionedTerraformFolder + "/" + terraformPrefix + v.Version.ToString()
|
versionedFileName := homeDir + versionedTerraformFolder + "/" + terraformPrefix + v.Version.ToString()
|
||||||
versionedFile, err := os.OpenFile(versionedFileName, os.O_WRONLY, 0755)
|
versionedFile, err := os.OpenFile(versionedFileName, os.O_WRONLY, 0755)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
//_, err = os.Create(versionedFileName)
|
|
||||||
//if err != nil {
|
|
||||||
// return err
|
|
||||||
//}
|
|
||||||
versionedFile, err = os.OpenFile(versionedFileName, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
|
versionedFile, err = os.OpenFile(versionedFileName, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -138,7 +138,7 @@ func TestIsVersionGreater(t *testing.T) {
|
|||||||
|
|
||||||
func TestGetVersionList(t *testing.T) {
|
func TestGetVersionList(t *testing.T) {
|
||||||
//todo write test for this
|
//todo write test for this
|
||||||
//response, _ := getVersionList()
|
//response, _ := GetVersionList()
|
||||||
//for _, Version := range response {
|
//for _, Version := range response {
|
||||||
// t.Errorf("%v", Version)
|
// t.Errorf("%v", Version)
|
||||||
//}
|
//}
|
||||||
|
Loading…
Reference in New Issue
Block a user