diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2018-05-15 11:04:09 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2018-05-15 11:04:09 -0700 |
commit | 30c410f443743bef3cff0fe7486c5ebfebe9757f (patch) | |
tree | 618a84eaf2045eed7ed409423e160500ec089dc0 /alot/helper.py | |
parent | 94f4166f8e184f1a69c9793e754630e93e4b31ad (diff) |
alot/helper: allow call_cmd to take bytes or strings as stdin
This might be a little sloppy, but there are legitimate cases where
stdin is bytes, and cases where it is a string.
Diffstat (limited to 'alot/helper.py')
-rw-r--r-- | alot/helper.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/alot/helper.py b/alot/helper.py index e621f751..b1880165 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -275,12 +275,12 @@ def call_cmd(cmdlist, stdin=None): by :meth:`subprocess.Popen` :type cmdlist: list of str :param stdin: string to pipe to the process - :type stdin: str + :type stdin: str, bytes, or None :return: triple of stdout, stderr, return value of the shell command - :rtype: str, str, intd + :rtype: str, str, int """ termenc = urwid.util.detected_encoding - if stdin: + if isinstance(stdin, str): stdin = stdin.encode(termenc) try: proc = subprocess.Popen( |