aboutsummaryrefslogtreecommitdiffstats
path: root/commands/msg/unsubscribe.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-09-30 10:52:49 +0200
committerRobin Jarry <robin@jarry.cc>2022-10-01 15:46:49 +0200
commit92ba132d70fe1d9afabe3cf4f23376025ccff897 (patch)
tree9be550d0c25c9d0367a144317312774d3e3c53e4 /commands/msg/unsubscribe.go
parent8e53d330614fb5c526372e6bdf508341bb6f154c (diff)
downloadaerc-92ba132d70fe1d9afabe3cf4f23376025ccff897.tar.gz
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 <robin@jarry.cc> Tested-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Moritz Poldrack <moritz@poldrack.dev>
Diffstat (limited to 'commands/msg/unsubscribe.go')
-rw-r--r--commands/msg/unsubscribe.go8
1 files changed, 5 insertions, 3 deletions
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")
}