Skip to content
This repository was archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #31 from cybozu/expand-user-data-dir
Browse files Browse the repository at this point in the history
fix: expand environment variables of chrome user data dir
  • Loading branch information
miyajan authored Apr 11, 2019
2 parents ced77a2 + 73f7e53 commit 81412f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion idp/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/chromedp/chromedp/runner"
"github.com/cybozu/assam/aws"
"net/url"
"os"
)

const (
Expand Down Expand Up @@ -72,9 +73,12 @@ func (a *Azure) logHandler(_ string, is ...interface{}) {
}

func (a *Azure) setupCDP(ctx context.Context, userDataDir string) (*chromedp.CDP, error) {
// Need to expand environment variables because chromedp does not expand.
expandedDir := os.ExpandEnv(userDataDir)

// Need log handler to handle network events.
c, err := chromedp.New(ctx, chromedp.WithLog(a.logHandler),
chromedp.WithRunnerOptions(runner.Flag("user-data-dir", userDataDir)))
chromedp.WithRunnerOptions(runner.Flag("user-data-dir", expandedDir)))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 81412f1

Please sign in to comment.