code: async def call_cmd_async(cmdlist, stdin=None, env=None):
      
      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)
docs: 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() method fo 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]