summary refs log tree commit diff stats
path: root/lib/open_darwin.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/open_darwin.go')
-rw-r--r--lib/open_darwin.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/open_darwin.go b/lib/open_darwin.go
index 0ffd9a1..d98c898 100644
--- a/lib/open_darwin.go
+++ b/lib/open_darwin.go
@@ -4,7 +4,18 @@ import (
 	"os/exec"
 )
 
-func OpenFile(filename string) error {
+func OpenFile(filename string, onErr func(error)) {
 	cmd := exec.Command("open", filename)
-	return cmd.Run()
+	err := cmd.Start()
+	if err != nil && onErr != nil {
+		onErr(err)
+		return
+	}
+
+	go func() {
+		err := cmd.Wait()
+		if err != nil && onErr != nil {
+			onErr(err)
+		}
+	}()
 }