Skip to content

Commit 990ddda

Browse files
ShawkyZBBerabi
andauthored
fix: redirect stdout to stderr for browser pkg (#689)
Co-authored-by: Berkay Beraby <[email protected]>
1 parent ce40327 commit 990ddda

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

domain/ide/command/open_browser.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121

2222
"github.com/rs/zerolog"
2323

24-
"github.com/snyk/go-application-framework/pkg/auth"
2524
"github.com/snyk/snyk-ls/internal/types"
2625
)
2726

@@ -37,6 +36,6 @@ func (cmd *openBrowserCommand) Command() types.CommandData {
3736
func (cmd *openBrowserCommand) Execute(ctx context.Context) (any, error) {
3837
url := cmd.command.Arguments[0].(string)
3938
cmd.logger.Debug().Str("method", "openBrowserCommand.Execute").Msgf("opening browser url %s", url)
40-
auth.OpenBrowser(url)
39+
types.DefaultOpenBrowserFunc(url)
4140
return nil, nil
4241
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ require (
2020
github.com/otiai10/copy v1.14.0
2121
github.com/pact-foundation/pact-go v1.10.0
2222
github.com/pingcap/errors v0.11.4
23+
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
2324
github.com/pkg/errors v0.9.1
2425
github.com/puzpuzpuz/xsync v1.5.2
2526
github.com/puzpuzpuz/xsync/v3 v3.4.0
@@ -98,7 +99,6 @@ require (
9899
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
99100
github.com/perimeterx/marshmallow v1.1.5 // indirect
100101
github.com/pjbgf/sha1cd v0.3.0 // indirect
101-
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
102102
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
103103
github.com/rivo/uniseg v0.4.7 // indirect
104104
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect

internal/types/command.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ package types
1818

1919
import (
2020
"context"
21+
"github.com/pkg/browser"
22+
"os"
2123
"sync"
22-
23-
"github.com/snyk/go-application-framework/pkg/auth"
2424
)
2525

2626
const (
@@ -47,7 +47,10 @@ const (
4747
)
4848

4949
var (
50-
DefaultOpenBrowserFunc = func(url string) { auth.OpenBrowser(url) }
50+
DefaultOpenBrowserFunc = func(url string) {
51+
browser.Stdout = os.Stderr
52+
_ = browser.OpenURL(url)
53+
}
5154
)
5255

5356
type Command interface {

0 commit comments

Comments
 (0)