Skip to content

Commit

Permalink
Disable browser open on Windows (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
patricksanders committed Apr 26, 2021
1 parent aa2af3d commit 0a99bbc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (e Error) Error() string { return string(e) }
const (
NoCredentialsFoundInCache = Error("no credentials found in cache")
NoDefaultRoleSet = Error("no default role set")
CredentialGenerationFailed = Error("credential generation failed")
BrowserOpenError = Error("could not launch browser, open link manually")
CredentialRetrievalError = Error("failed to retrieve credentials from broker")
InvalidJWT = Error("JWT is invalid")
InvalidArn = Error("requested ARN is invalid")
Expand Down
9 changes: 5 additions & 4 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package util

import (
"errors"
"fmt"
"io/ioutil"
"net/http"
Expand All @@ -26,6 +25,7 @@ import (
"runtime"
"strings"

"github.com/netflix/weep/errors"
"github.com/netflix/weep/logging"
)

Expand All @@ -49,7 +49,7 @@ type ErrorResponse struct {

func validate(arn string, pieces []string) error {
if len(pieces) < 6 {
return fmt.Errorf("malformed ARN: %s", arn)
return errors.InvalidArn
}
return nil
}
Expand Down Expand Up @@ -120,7 +120,8 @@ func OpenLink(link string) error {
openUrlCommand = []string{"xdg-open"}
}
case "windows":
openUrlCommand = []string{"cmd", "/C", "start"}
// This is unsupported until we find a safer way to run the open command in Windows.
return errors.BrowserOpenError
}

if openUrlCommand != nil {
Expand All @@ -135,7 +136,7 @@ func OpenLink(link string) error {
log.Infoln("Link opened in a new browser window.")
}
} else {
return errors.New("Could not automatically launch browser window. Open the above link manually to continue.")
return errors.BrowserOpenError
}
return nil
}
Expand Down

0 comments on commit 0a99bbc

Please sign in to comment.