Skip to content

xdg-mime: return correct exit code for GNOME

Martin Puppe requested to merge mpuppe/xdg-utils:xdg-mime_silent_fail into master

If the desktop environment was GNOME and none of the commands for detecting the MIME type of a file was available, xdg-mime used to return exit code 0 even though it failed. The man page says it should return exit code 3. This commit fixes the issue.

I have considered returning exit code 4 instead since that is what would be returned if info_kde() or info_generic() fail to find a tool for MIME type detection. But I have decided to implement the behavior as specified in the man page.

The exit code of an if construct is 0 if no condition tested true 1. The author of the original code probably was not aware of this.


Merge request reports