Description of the issue: I’ve set my default browser to be Obsidian, and confirmed that from the command line execute
xdg-open "http://community.brave.com/" will launch Brave. However, if I run Obsidian (an app you can download from https://obsidian.md/ ) and click on a link in my Obsidian document, the link is opened in Firefox instead of Brave. This is because Brave seems to be crashing with exit code 141 when executed via Obsidian → xdg-open → Brave
How can this issue be reproduced?
- Run Obsidian.
- Write a document with a link on it.
- Ctrl-click on the link.
Expected result: The link will be opened in Brave.
Brave Version( check
About Brave): Version 1.46.144 Chromium: 108.0.5359.128 (Official Build) (64-bit)
Obsidian, like most Linux applications, uses
xdg-open to decide how to open a link.
In the source code for xdg-open, there’s a function
search_desktop_file which searches through all the
.desktop files, and tries to execute the relevant one
Once xdg-open finds the right desktop file, it does this:
env "$command" "$@" if [ $? -eq 0 ]; then exit_success fi
Where I’ve confirmed that
$@ is the URL to open.
When I run
xdg-open https://example.com/ from the command line, the exit code is 0, and so xdg-open is satisfied and stops here, performing the
But when I click on a link in Obsidian, the exit code is 141, and so xdg-open doesn’t exit, and proceeds to execute some fallback logic, which eventually leads to running Firefox.
It’s unclear to me why Brave is using exit code 0 in one case and exit code 141 in the other.