diff options
author | Anton Khirnov <anton@khirnov.net> | 2021-01-26 11:38:03 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2021-01-26 11:57:08 +0100 |
commit | 13cba7ad0bfcbb8eacfffaf1913d11897c8f91c2 (patch) | |
tree | 9bfb117a8b4f1d9d1b1eff9fc1b0fb07006793d6 /alot/helper.py | |
parent | 0e7103d9e388c684097ea5bc998e598903889ef6 (diff) |
addressbook/external: stop using call_cmd()
It does not actually save any code. The new code also uses a shell as is
documented.
Remove call_cmd(), as it no longer has any callers.
Diffstat (limited to 'alot/helper.py')
-rw-r--r-- | alot/helper.py | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/alot/helper.py b/alot/helper.py index 4bdb9731..8a7261e5 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -9,15 +9,12 @@ import mimetypes import os import re import shlex -import subprocess import email from email.mime.audio import MIMEAudio from email.mime.base import MIMEBase from email.mime.image import MIMEImage from email.mime.text import MIMEText -import asyncio -import urwid import magic @@ -130,44 +127,6 @@ def shorten_author_string(authors_string, maxlength): return authorsstring -def call_cmd(cmdlist, stdin=None): - """ - get a shell commands output, error message and return value and immediately - return. - - .. warning:: - - This returns with the first screen content for interactive commands. - - :param cmdlist: shellcommand to call, already splitted into a list accepted - by :meth:`subprocess.Popen` - :type cmdlist: list of str - :param stdin: string to pipe to the process - :type stdin: str, bytes, or None - :return: triple of stdout, stderr, return value of the shell command - :rtype: str, str, int - """ - termenc = urwid.util.detected_encoding - try: - - logging.debug("Calling %s" % cmdlist) - proc = subprocess.Popen( - cmdlist, - encoding = termenc, errors = 'backslashreplace', - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - stdin=subprocess.PIPE if stdin is not None else None) - except OSError as e: - out = '' - err = e.strerror - ret = e.errno - else: - out, err = proc.communicate(stdin) - ret = proc.returncode - - return out, err, ret - - def guess_mimetype(blob): """ uses file magic to determine the mime-type of the given data blob. |