docs: def run(command, encoding=None, decode=True, cwd=None):
      """Run a command [cmd, arg1, arg2, ...].
  
      Returns the output (stdout + stderr).
  
      Raises CommandFailed in cases of error.
      """
      if not encoding:
          encoding = locale.getpreferredencoding()
      try:
          with open(os.devnull, 'rb') as devnull:
              pipe = subprocess.Popen(command, stdin=devnull,
                                      stdout=subprocess.PIPE,
                                      stderr=subprocess.STDOUT, cwd=cwd)
      except OSError as e:
          raise Failure("could not run %s: %s" % (command, e))
      output = pipe.communicate()[0]
      if decode:
          output = output.decode(encoding)
      status = pipe.wait()
      if status != 0:
          raise CommandFailed(command, status, output)
      return output