def _exec_tarsnap(self, args):
        self.log.debug("Executing: %s" % " ".join(args))
        env = os.environ
        env['LANG'] = 'C' # ensure the tarsnap output is in english
        child = pexpect.spawn(args[0], args[1:], env=env, timeout=None)

        if self.log.isEnabledFor(logging.DEBUG):
            child.logfile = sys.stdout

        # look for the passphrase prompt
        has_prompt = (child.expect(['Please enter passphrase for keyfile .*?:', pexpect.EOF]) == 0)
        if has_prompt:
            child.sendline(self._get_key_passphrase())
            child.expect(pexpect.EOF)
        out = child.before
        child.close()

        if child.exitstatus != 0:
            raise TarsnapError("tarsnap failed with status {0}:{1}{2}".format(
                        child.exitstatus, os.linesep, out))
        return out
dataset/ETHPy150Open miracle2k/tarsnapper/src/tarsnapper/script.py/TarsnapBackend._exec_tarsnap/original