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>
This commit is contained in:
parent
8e53d33061
commit
92ba132d70
3 changed files with 19 additions and 73 deletions
commands/msg
|
@ -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")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue