diff options
author | Michael Ilsaas <mikeri@mikeri.net> | 2018-04-28 09:32:18 +0200 |
---|---|---|
committer | Michael Ilsaas <mikeri@mikeri.net> | 2018-04-28 09:32:18 +0200 |
commit | 1f4d1a3dbbfd2d116d8685fe38be3a3ce91cd34a (patch) | |
tree | 2a55b5ab30b69b28a0f59be753d6b44363497019 | |
parent | 3db6e6af38c45e01605d2f143281b59f6efc79db (diff) | |
download | ranger-1f4d1a3dbbfd2d116d8685fe38be3a3ce91cd34a.tar.gz |
Handle not installed mimetypes command
-rwxr-xr-x | ranger/ext/rifle.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py index 69a561a8..1bc7e3b6 100755 --- a/ranger/ext/rifle.py +++ b/ranger/ext/rifle.py @@ -262,10 +262,13 @@ class Rifle(object): # pylint: disable=too-many-instance-attributes mimetype, _ = process.communicate() self._mimetype = mimetype.decode(ENCODING).strip() if self._mimetype == 'application/octet-stream': - process = Popen(["mimetype", "--output-format", "%m", fname], - stdout=PIPE, stderr=PIPE) - mimetype, _ = process.communicate() - self._mimetype = mimetype.decode(ENCODING).strip() + try: + process = Popen(["mimetype", "--output-format", "%m", fname], + stdout=PIPE, stderr=PIPE) + mimetype, _ = process.communicate() + self._mimetype = mimetype.decode(ENCODING).strip() + except: + pass return self._mimetype def _build_command(self, files, action, flags): |