about summary refs log blame commit diff stats
path: root/lib/open.go
blob: ebcf8780174551d0126f675df0b2c08c4c59bf06 (plain) (tree)
1
2
3
4
5
6
7
8
9







                 
                                                   
                                                 











                                               
 
// +build !darwin

package lib

import (
	"os/exec"
)

func OpenFile(filename string, onErr func(error)) {
	cmd := exec.Command("xdg-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)
		}
	}()
}