summaryrefslogtreecommitdiff
path: root/stub.py
diff options
context:
space:
mode:
authorLex Neva <github.com@lexneva.name>2019-07-28 20:18:52 -0400
committerLex Neva <github.com@lexneva.name>2019-07-28 20:18:52 -0400
commit13d44e1f0749a6e4fea0dd7e6f77d95a1482aace (patch)
tree18da75a01b6a99c57f9607e91491ee6bddba1e94 /stub.py
parent27670996b4ecac97d261f6f9e08c6db18b128429 (diff)
deal with None encoding in python 2
Diffstat (limited to 'stub.py')
-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)