summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/linemode.py11
-rw-r--r--ranger/ext/vcs/vcs.py8
2 files changed, 16 insertions, 3 deletions
diff --git a/ranger/core/linemode.py b/ranger/core/linemode.py
index 96557515..f63cb142 100644
--- a/ranger/core/linemode.py
+++ b/ranger/core/linemode.py
@@ -97,9 +97,16 @@ class FileInfoLinemode(LinemodeBase):
 
     def infostring(self, file, metadata):
         if not file.is_directory:
-            from subprocess import check_output, CalledProcessError
+            from subprocess import Popen, PIPE, CalledProcessError
             try:
-                fileinfo = check_output(["file", "-bL", file.path]).strip()
+                process = Popen(["file", "-bL", file.path], stdout=PIPE)
+                output, unused_err = process.communicate()
+                retcode = process.poll()
+                if retcode:
+                    error = subprocess.CalledProcessError(retcode, "file")
+                    error.output = output
+                    raise error
+                fileinfo = output.strip()
             except CalledProcessError:
                 return "unknown"
             if sys.version_info[0] >= 3:
diff --git a/ranger/ext/vcs/vcs.py b/ranger/ext/vcs/vcs.py
index cb8137e3..a101e3f4 100644
--- a/ranger/ext/vcs/vcs.py
+++ b/ranger/ext/vcs/vcs.py
@@ -119,7 +119,13 @@ class Vcs(object):  # pylint: disable=too-many-instance-attributes
         with open(os.devnull, 'w') as devnull:
             try:
                 if catchout:
-                    output = subprocess.check_output(cmd, cwd=path, stderr=devnull)
+                    process = subprocess.Popen(cmd, cwd=path, stdout=subprocess.PIPE, stderr=devnull)
+                    output, unused_err = process.communicate()
+                    retcode = process.poll()
+                    if retcode:
+                        error = subprocess.CalledProcessError(retcode, cmd)
+                        error.output = output
+                        raise error
                     if retbytes:
                         return output
                     else: