#4190 Decode the output from the shell commands if they are not already unicode
Merged 5 months ago by pingou. Opened 5 months ago by pingou.

file modified
+3 -3

@@ -1215,16 +1215,16 @@ 


      retcode = procs.wait()

      (out, err) = procs.communicate(input)

-     if not isinstance(out, str):

+     if isinstance(out, six.binary_type):

          out = out.decode("utf-8")

-     if not isinstance(err, str):

+     if isinstance(err, six.binary_type):

          err = err.decode("utf-8")

      if retcode:

          print("ERROR: %s =-- %s" % (cmd, retcode))



      if not keepends:

-         out = out.rstrip("\n\r")

+         out = out.rstrip(u"\n\r")


      if error:

          return (out, err)

Signed-off-by: Pierre-Yves Chibon pingou@pingoured.fr

rebased onto 909539656aa557bdba30822a2d2a9e77fa715166

5 months ago

rebased onto 1138f8d34d53594411ec58240c777699d4af9ebe

5 months ago

I guess you need to change your commit message to also specify the changes related to six check and binary type who introduce better compatibility with python 2 and 3.

rebased onto 6e566ad

5 months ago

Thanks for the reviews and comments :)

Pull-Request has been merged by pingou

5 months ago