aboutsummaryrefslogtreecommitdiffstats
path: root/lib/open.go
diff options
context:
space:
mode:
Diffstat (limited to 'lib/open.go')
-rw-r--r--lib/open.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/open.go b/lib/open.go
index ad6533e1..ebcf8780 100644
--- a/lib/open.go
+++ b/lib/open.go
@@ -6,7 +6,18 @@ import (
"os/exec"
)
-func OpenFile(filename string) error {
+func OpenFile(filename string, onErr func(error)) {
cmd := exec.Command("xdg-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)
+ }
+ }()
}