From bb16cc112613b23ad940d49df889b79c8061a337 Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 1 Sep 2021 17:53:16 +0200 Subject: popen_forked: Force UTF-8 encoding --- ranger/ext/popen_forked.py | 5 +++-- 1 file 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 -- cgit 1.4.1-2-gfad0