blob: a189980ac3dfc69cdbdb49305c3e5aa6492b5d5d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package lib
import (
"fmt"
"os/exec"
"runtime"
"git.sr.ht/~rjarry/aerc/logging"
)
func XDGOpen(uri string) error {
openBin := "xdg-open"
if runtime.GOOS == "darwin" {
openBin = "open"
}
args := []string{openBin, uri}
logging.Infof("running command: %v", args)
cmd := exec.Command(args[0], args[1:]...)
out, err := cmd.CombinedOutput()
logging.Debugf("command: %v exited. err=%v out=%s", args, err, out)
if err != nil {
return fmt.Errorf("%v: %w", args, err)
}
return nil
}
|