From 92ba132d70fe1d9afabe3cf4f23376025ccff897 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Fri, 30 Sep 2022 10:52:49 +0200 Subject: open: simplify code There is no need for convoluted channels and other async fanciness. Expose a single XDGOpen static function that runs a command and returns an error if any. Caller is responsible of running this in an async goroutine if needed. Signed-off-by: Robin Jarry Tested-by: Tim Culverhouse Acked-by: Moritz Poldrack --- commands/msg/unsubscribe.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'commands/msg') diff --git a/commands/msg/unsubscribe.go b/commands/msg/unsubscribe.go index 3982f7ba..a9116e9d 100644 --- a/commands/msg/unsubscribe.go +++ b/commands/msg/unsubscribe.go @@ -183,9 +183,11 @@ func unsubscribeHTTP(aerc *widgets.Aerc, u *url.URL) error { aerc.CloseDialog() switch option { case "Yes": - if err := lib.NewXDGOpen(u.String()).Start(); err != nil { - aerc.PushError("Unsubscribe:" + err.Error()) - } + go func() { + if err := lib.XDGOpen(u.String()); err != nil { + aerc.PushError("Unsubscribe:" + err.Error()) + } + }() default: aerc.PushError("Unsubscribe: link will not be opened") } -- cgit