mirror of
https://git.sr.ht/~sircmpwn/aerc
synced 2024-11-23 08:32:12 +01:00
fda3f43e7c
This stops the ui being blocked while the resource is opened. The wait ensures that resources are reclaimed when the process finishes while aerc is still running.
24 lines
321 B
Go
24 lines
321 B
Go
// +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)
|
|
}
|
|
}()
|
|
}
|