Skip to content

Fix running project on Windows #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion browser.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,5 @@ func runCmd(prog string, args ...string) error {
cmd := exec.Command(prog, args...)
cmd.Stdout = Stdout
cmd.Stderr = Stderr
setFlags(cmd)
return cmd.Run()
}
2 changes: 0 additions & 2 deletions browser_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ import "os/exec"
func openBrowser(url string) error {
return runCmd("open", url)
}

func setFlags(cmd *exec.Cmd) {}
2 changes: 0 additions & 2 deletions browser_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ func openBrowser(url string) error {
}
return err
}

func setFlags(cmd *exec.Cmd) {}
2 changes: 0 additions & 2 deletions browser_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ func openBrowser(url string) error {

return &exec.Error{Name: strings.Join(providers, ","), Err: exec.ErrNotFound}
}

func setFlags(cmd *exec.Cmd) {}
2 changes: 0 additions & 2 deletions browser_openbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ func openBrowser(url string) error {
}
return err
}

func setFlags(cmd *exec.Cmd) {}
2 changes: 0 additions & 2 deletions browser_unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ import (
func openBrowser(url string) error {
return fmt.Errorf("openBrowser: unsupported operating system: %v", runtime.GOOS)
}

func setFlags(cmd *exec.Cmd) {}
10 changes: 4 additions & 6 deletions browser_windows.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
//go:generate mkwinsyscall -output zbrowser_windows.go browser_windows.go
//sys ShellExecute(hwnd int, verb string, file string, args string, cwd string, showCmd int) (err error) = shell32.ShellExecuteW
//sys shellExecute(hwnd int, verb string, file string, args string, cwd string, showCmd int) (err error) = shell32.ShellExecuteW
package browser

import "os/exec"
const SW_SHOWNORMAL = 1

func openBrowser(url string) error {
return ShellExecute(0, "", url, "", "", SW_SHOWNORMAL)
}
const sW_SHOWNORMAL = 1

func setFlags(cmd *exec.Cmd) {
func openBrowser(url string) error {
return shellExecute(0, "", url, "", "", sW_SHOWNORMAL)
}
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
module github.com/pkg/browser

go 1.14

require golang.org/x/sys v0.0.0-20210319071255-635bc2c9138d // indirect
6 changes: 3 additions & 3 deletions zbrowser_windows.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.