Skip to content

Commit fe213f9

Browse files
fix: silence SSO browser stdout (#916)
1 parent 775e896 commit fe213f9

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

cmd/testing/browser/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package main
22

33
import (
4+
"fmt"
45
"os"
56
)
67

78
// This package is used to test browser features in tests
89
func main() {
10+
// Make sure we can handle a browser printing something stdout (like Chrome does)
11+
fmt.Println("Opening in existing browser session.")
912
os.Exit(0)
1013
}

pkg/idclogin/run.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"os"
78
"os/exec"
89
"time"
910

@@ -95,6 +96,8 @@ func Login(ctx context.Context, cfg aws.Config, startUrl string, scopes []string
9596
} else {
9697
clio.Debugf("running command without forkprocess: %s", args)
9798
cmd := exec.Command(args[0], args[1:]...)
99+
cmd.Stdout = os.Stderr
100+
cmd.Stderr = os.Stderr
98101
startErr = cmd.Start()
99102
}
100103

@@ -108,6 +111,8 @@ func Login(ctx context.Context, cfg aws.Config, startUrl string, scopes []string
108111

109112
} else if config.CustomSSOBrowserPath != "" {
110113
cmd := exec.Command(config.CustomSSOBrowserPath, url)
114+
cmd.Stdout = os.Stderr
115+
cmd.Stderr = os.Stderr
111116
err = cmd.Start()
112117
if err != nil {
113118
// fail silently

0 commit comments

Comments
 (0)