open reap children
This commit is contained in:
parent
180ecc36cc
commit
22b982d963
@ -20,8 +20,16 @@ package open
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"maunium.net/go/gomuks/debug"
|
||||
)
|
||||
|
||||
func Open(input string) error {
|
||||
return exec.Command("xdg-open", input).Start()
|
||||
cmd := exec.Command("xdg-open", input)
|
||||
err := cmd.Start()
|
||||
if err != nil {
|
||||
debug.Print("xdg-open error:", err)
|
||||
} else {
|
||||
go cmd.Wait()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
@ -360,6 +360,7 @@ func (view *MessageView) SetSelected(message *messages.UIMessage) {
|
||||
|
||||
func (view *MessageView) handleMessageClick(message *messages.UIMessage, mod tcell.ModMask) bool {
|
||||
if msg, ok := message.Renderer.(*messages.FileMessage); ok && mod > 0 && !msg.Thumbnail.IsEmpty() {
|
||||
debug.Print("Opening thumbnail", msg.ThumbnailPath())
|
||||
open.Open(msg.ThumbnailPath())
|
||||
// No need to re-render
|
||||
return false
|
||||
|
@ -713,6 +713,7 @@ func (view *RoomView) Download(url id.ContentURI, file *attachment.EncryptedFile
|
||||
view.AddServiceMessage(fmt.Sprintf("File downloaded to %s", path))
|
||||
view.parent.parent.Render()
|
||||
if openFile {
|
||||
debug.Print("Opening file", path)
|
||||
open.Open(path)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user