🐛 Fix a unicode issue under win32

subprocess env must not contain unicode strings but could now after some
py3 related refactorings.
This commit is contained in:
Gina Häußge committed 2019-12-12 12:43:13 +01:00
1 parent 9661469532
commit 33b89550a4
1 file changed
+6 -1
+6 -1
View File
@@ -11,7 +11,8 @@ import logging
import re
import time
from . import to_unicode
from . import to_unicode, to_bytes
from .platform import get_os
from past.builtins import unicode
@@ -164,6 +165,10 @@ class CommandlineCaller(object):
self._logger.debug("Calling: {}".format(joined_command))
self.on_log_call(joined_command)
# if we are running under windows, make sure there are no unicode strings in the env
if get_os() == "windows" and "env" in kwargs:
kwargs["env"] = dict((k, to_bytes(v)) for k, v in kwargs["env"].items())
kwargs.update(dict(async_=True, stdout=sarge.Capture(), stderr=sarge.Capture()))
p = sarge.run(command, **kwargs)