Use SetPrepareCmd hook to spy on OpenInBrowser
We are now able to assert that the browse command was called with the correct URL
This commit is contained in:
parent
d881a2e52e
commit
f6fcdf114e
3 changed files with 46 additions and 31 deletions
|
|
@ -27,7 +27,7 @@ func ConcatPaths(paths ...string) string {
|
|||
return strings.Join(paths, "/")
|
||||
}
|
||||
|
||||
var OpenInBrowser = func(url string) error {
|
||||
func OpenInBrowser(url string) error {
|
||||
browser := os.Getenv("BROWSER")
|
||||
if browser == "" {
|
||||
browser = searchBrowserLauncher(runtime.GOOS)
|
||||
|
|
@ -45,7 +45,8 @@ var OpenInBrowser = func(url string) error {
|
|||
}
|
||||
|
||||
endingArgs := append(browserArgs[1:], url)
|
||||
return exec.Command(browserArgs[0], endingArgs...).Run()
|
||||
browseCmd := exec.Command(browserArgs[0], endingArgs...)
|
||||
return PrepareCmd(browseCmd).Run()
|
||||
}
|
||||
|
||||
func searchBrowserLauncher(goos string) (browser string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue