2019-07-03 00:21:34 +02:00
|
|
|
// +build !darwin
|
|
|
|
|
|
|
|
package lib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
)
|
|
|
|
|
2020-07-06 21:14:15 +02:00
|
|
|
func OpenFile(filename string, onErr func(error)) {
|
2019-07-03 00:21:34 +02:00
|
|
|
cmd := exec.Command("xdg-open", filename)
|
2020-07-06 21:14:15 +02:00
|
|
|
err := cmd.Start()
|
|
|
|
if err != nil && onErr != nil {
|
|
|
|
onErr(err)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
go func() {
|
|
|
|
err := cmd.Wait()
|
|
|
|
if err != nil && onErr != nil {
|
|
|
|
onErr(err)
|
|
|
|
}
|
|
|
|
}()
|
2019-07-03 00:21:34 +02:00
|
|
|
}
|