1
0
mirror of https://git.sr.ht/~sircmpwn/aerc synced 2024-11-23 16:42:07 +01:00
aerc/lib/open_darwin.go

22 lines
298 B
Go
Raw Normal View History

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)
}
}()
}