File tree 2 files changed +9
-12
lines changed
2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change 7
7
"fmt"
8
8
"io"
9
9
"io/ioutil"
10
+ "os"
11
+ "os/exec"
10
12
"path/filepath"
11
13
)
12
14
@@ -40,3 +42,10 @@ func OpenReader(r io.Reader) error {
40
42
func OpenURL (url string ) error {
41
43
return openBrowser (url )
42
44
}
45
+
46
+ func runCmd (prog string , args ... string ) error {
47
+ cmd := exec .Command (prog , args ... )
48
+ cmd .Stdout = os .Stdout
49
+ cmd .Stderr = os .Stderr
50
+ return cmd .Run ()
51
+ }
Original file line number Diff line number Diff line change 1
1
package browser
2
2
3
- import (
4
- "os"
5
- "os/exec"
6
- )
7
-
8
3
func openBrowser (url string ) error {
9
4
// try sensible-browser first
10
5
if err := runCmd ("sensible-browser" , url ); err == nil {
@@ -13,10 +8,3 @@ func openBrowser(url string) error {
13
8
// sensible-browser not availble, try xdg-open
14
9
return runCmd ("xdg-open" , url )
15
10
}
16
-
17
- func runCmd (prog string , args ... string ) error {
18
- cmd := exec .Command (prog , args ... )
19
- cmd .Stdout = os .Stdout
20
- cmd .Stderr = os .Stderr
21
- return cmd .Run ()
22
- }
You can’t perform that action at this time.
0 commit comments