summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2019-08-05 22:39:21 -0400
committerGitHub <noreply@github.com>2019-08-05 22:39:21 -0400
commitcdb8d1d0d4a6dba9a1eb146167b1aef01de0e9d6 (patch)
treecc3a149656ee76bd8391ff1e51d552b40d0de6ea
parent956ec51a8bb74c3dd1520de2a70680bb533453c1 (diff)
parent13d44e1f0749a6e4fea0dd7e6f77d95a1482aace (diff)
Merge pull request #503 from inkstitch/lneva/stub-unicode
deal with None encoding in python 2
-rw-r--r--stub.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/stub.py b/stub.py
index c7ff5fa5..80296f7d 100644
--- a/stub.py
+++ b/stub.py
@@ -48,12 +48,18 @@ if sys.platform == "win32":
import msvcrt
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
-sys.stdout.write(stdout.decode(sys.stdout.encoding))
+if sys.stdout.encoding:
+ stdout = stdout.decode(sys.stdout.encoding)
+
+sys.stdout.write(stdout)
sys.stdout.flush()
stderr = stderr.strip()
if stderr:
- sys.stderr.write(stderr.decode(sys.stdout.encoding).strip())
+ if sys.stderr.encoding:
+ stderr = stderr.decode(sys.stderr.encoding)
+
+ sys.stderr.write(stderr)
sys.stderr.flush()
sys.exit(extension.returncode)