Skip to content

systemd: Fix bytes/unicode issue

Mathieu Bridon requested to merge gh-2dec22f0/271/bochecha/python3 into master

The problem is that the stdout and stderr of a subprocess.Popen call are bytes, not unicode.

And then in the code, we mix that with string literals... which were bytes in Python2, but unicode in Python3.

The unit tests never found the problem, because we mock the Popen and its stdout/stderr, replacing the latter by StringIO.

And in Python3, StringIO take unicode, not bytes, so everything was just fine for the unit tests.

Merge request reports