about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2021-09-01 17:53:16 +0200
committertoonn <toonn@toonn.io>2021-09-01 17:57:15 +0200
commitbb16cc112613b23ad940d49df889b79c8061a337 (patch)
tree28c060c6e9e1cd0f10f6d802ea194ae5cdf7aa95
parent7c7f3902f61e41f0367643d2eaca9f3ca49d370e (diff)
downloadranger-bb16cc112613b23ad940d49df889b79c8061a337.tar.gz
popen_forked: Force UTF-8 encoding
-rw-r--r--ranger/ext/popen_forked.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ranger/ext/popen_forked.py b/ranger/ext/popen_forked.py
index 8f73e355..40a5b833 100644
--- a/ranger/ext/popen_forked.py
+++ b/ranger/ext/popen_forked.py
@@ -8,7 +8,6 @@ from io import open
 from subprocess import Popen
 
 
-
 def Popen_forked(*args, **kwargs):  # pylint: disable=invalid-name
     """Forks process and runs Popen with the given args and kwargs.
 
@@ -20,7 +19,9 @@ def Popen_forked(*args, **kwargs):  # pylint: disable=invalid-name
         return False
     if pid == 0:
         os.setsid()
-        with open(os.devnull, 'r') as null_r, open(os.devnull, 'w') as null_w:
+        with open(os.devnull, 'r', encoding="utf-8") as null_r, open(
+            os.devnull, 'w', encoding="utf-8"
+        ) as null_w:
             kwargs['stdin'] = null_r
             kwargs['stdout'] = kwargs['stderr'] = null_w
             Popen(*args, **kwargs)  # pylint: disable=consider-using-with