summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-02-22 15:08:24 -0800
committerDylan Baker <dylan@pnwbakers.com>2018-03-01 10:34:56 -0800
commit301c471b496757676ee912888c5df2df399b48b1 (patch)
tree9077d1b55e22ec89e027f134ccb3c83de30f2f33 /alot
parentd0a1c35a3fb77fa70bca595c69874dcdd8d65233 (diff)
alot/command/globals: fix py3k
Diffstat (limited to 'alot')
-rw-r--r--alot/commands/globals.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py
index 7e9b1bd9..b5ad191a 100644
--- a/alot/commands/globals.py
+++ b/alot/commands/globals.py
@@ -12,7 +12,7 @@ import glob
import logging
import os
import subprocess
-from io import StringIO
+from io import BytesIO
import urwid
from twisted.internet.defer import inlineCallbacks
@@ -251,7 +251,9 @@ class ExternalCommand(Command):
if self.stdin is not None:
# wrap strings in StrinIO so that they behaves like a file
if isinstance(self.stdin, str):
- stdin = StringIO(self.stdin)
+ # XXX: is utf-8 always safe to use here, or do we need to check
+ # the terminal encoding first?
+ stdin = BytesIO(self.stdin.encode('utf-8'))
else:
stdin = self.stdin
@@ -278,7 +280,7 @@ class ExternalCommand(Command):
_, err = proc.communicate(stdin.read() if stdin else None)
if proc.returncode == 0:
return 'success'
- return err.strip()
+ return helper.try_decode(err).strip()
if self.in_thread:
d = threads.deferToThread(thread_code)