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:38:03 +0100 |
commit | dae098901104de7027c48dae2b9da08be2a17fac (patch) | |
tree | d432fc4ce4fdd2cbed835175f89b0fe48364319d /alot/helper.py | |
parent | 5cb88d559ae462dad80d346d44f12dcc9eb3ec10 (diff) |
account: stop using call_cmd_async() to run sendmail
It does not actually save any code. The new code also uses a shell as is
documented.
Remove call_cmd_async(), as it no longer has any callers.
Diffstat (limited to 'alot/helper.py')
-rw-r--r-- | alot/helper.py | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/alot/helper.py b/alot/helper.py index 9ba3c411..4bdb9731 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -168,44 +168,6 @@ def call_cmd(cmdlist, stdin=None): return out, err, ret -async def call_cmd_async(cmdlist, stdin=None, env=None): - """Given a command, call that command asynchronously and return the output. - - This function only handles `OSError` when creating the subprocess, any - other exceptions raised either durring subprocess creation or while - exchanging data with the subprocess are the caller's responsibility to - handle. - - If such an `OSError` is caught, then returncode will be set to 1, and the - error value will be set to the str() value of the exception. - - :type cmdlist: list of str - :param stdin: string to pipe to the process - :type stdin: str - :return: Tuple of stdout, stderr, returncode - :rtype: tuple[str, str, int] - """ - termenc = urwid.util.detected_encoding - cmdlist = [s.encode(termenc) for s in cmdlist] - - environment = os.environ.copy() - if env is not None: - environment.update(env) - logging.debug('ENV = %s', environment) - logging.debug('CMD = %s', cmdlist) - try: - proc = await asyncio.create_subprocess_exec( - *cmdlist, - env=environment, - stdout=asyncio.subprocess.PIPE, - stderr=asyncio.subprocess.PIPE, - stdin=asyncio.subprocess.PIPE if stdin else None) - except OSError as e: - return ('', str(e), 1) - out, err = await proc.communicate(stdin.encode(termenc) if stdin else None) - return (out.decode(termenc), err.decode(termenc), proc.returncode) - - def guess_mimetype(blob): """ uses file magic to determine the mime-type of the given data blob. |