aboutsummaryrefslogtreecommitdiffstats
path: root/lib/open_darwin.go
blob: d98c8988929a5850113930e3cc66103adef301ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package lib

import (
	"os/exec"
)

func OpenFile(filename string, onErr func(error)) {
	cmd := exec.Command("open", filename)
	err := cmd.Start()
	if err != nil && onErr != nil {
		onErr(err)
		return
	}

	go func() {
		err := cmd.Wait()
		if err != nil && onErr != nil {
			onErr(err)
		}
	}()
}