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