summaryrefslogtreecommitdiff
path: root/alot/commands/thread.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-03-02 08:51:27 -0800
committerDylan Baker <dylan@pnwbakers.com>2018-03-02 08:51:27 -0800
commit46d3e59d38ffe76cd92bd1a80c147463a764f04b (patch)
tree9ce11c92c2e9494f1bfac31bf67cec63fa43daa3 /alot/commands/thread.py
parent0507c04caa3f30c55f8943e6316ef36e3fa9475a (diff)
fix piping messages via stdin
Diffstat (limited to 'alot/commands/thread.py')
-rw-r--r--alot/commands/thread.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py
index c9d40b09..c64ced5c 100644
--- a/alot/commands/thread.py
+++ b/alot/commands/thread.py
@@ -14,6 +14,7 @@ from email.utils import getaddresses, parseaddr, formataddr
from email.message import Message
from twisted.internet.defer import inlineCallbacks
+import urwid
from io import StringIO
from . import Command, registerCommand
@@ -759,13 +760,14 @@ class PipeCommand(Command):
# do the monkey
for mail in pipestrings:
+ encoded_mail = mail.encode(urwid.util.detected_encoding)
if self.background:
logging.debug('call in background: %s', self.cmd)
proc = subprocess.Popen(self.cmd,
shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
- out, err = proc.communicate(mail)
+ out, err = proc.communicate(encoded_mail)
if self.notify_stdout:
ui.notify(out)
else:
@@ -777,7 +779,7 @@ class PipeCommand(Command):
stdin=subprocess.PIPE,
# stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
- out, err = proc.communicate(mail)
+ out, err = proc.communicate(encoded_mail)
if err:
ui.notify(err, priority='error')
return