cmd/pomerium-cli: do not require terminal with cached creds (#1196)

This commit is contained in:
Travis Groth 2020-08-04 08:36:14 -04:00 committed by GitHub
parent fa43db80c1
commit a555e5fcc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,10 +47,6 @@ var kubernetesCmd = &cobra.Command{
var kubernetesExecCredentialCmd = &cobra.Command{
Use: "exec-credential",
RunE: func(cmd *cobra.Command, args []string) error {
if !terminal.IsTerminal(int(os.Stdin.Fd())) {
return fmt.Errorf("only interactive sessions are supported")
}
if len(args) < 1 {
return fmt.Errorf("server url is required")
}
@ -66,6 +62,11 @@ var kubernetesExecCredentialCmd = &cobra.Command{
return nil
}
// require interactive session to handle login
if !terminal.IsTerminal(int(os.Stdin.Fd())) {
return fmt.Errorf("only interactive sessions are supported")
}
li, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
fatalf("failed to start listener: %v", err)