xdg-open: halt `search_desktop_file` upon locating the correct executable
This commit ensures that the recursive search through desktop files is halted when a valid desktop file that points to an executable present in the system path is found.
The previous behaviour tested for the outcome of an attempt to execute the executable and consequently failed to distinguish between the case of a missing executable and a valid execution exiting with a non-success value. In consequence, xdg-open would proceed to search through remaining desktop files and ultimately fall back on hard-coded defaults.
For instance, if the user had set mutt as their default handler for
mailto URLs, chose to ran xdg-open mailto:test@example.com
, and then
decided to abort sending the mail in mutt – hence resulting in mutt
exiting with a return value of 1 due to failing to send the e-mail –,
xdg-open would end up launching a fallback web browser upon mutt's exit.
With this commit, xdg-open terminates the search after locating the
desktop file and verifying mutt's presence in the user's path, exiting
with a return value of 0 on mutt success and 4 on mutt failure, thus
ensuring that none of the hard-coded backups are launched on mutt
failure.