Esempio n. 1
0
class GpgProcessError(GpgError):
    @classmethod
    def mk_from(cls, other: CalledProcessError) -> 'GpgProcessError':
        return GpgProcessError(**other.__dict__)

    def __init__(
            self,
            returncode: int,
            cmd: _CmdT,
            output: Optional[str] = None,
            stderr: Optional[str] = None
    ) -> None:
        cmd_str = _format_cmd(cmd)
        self._impl = CalledProcessError(returncode, cmd_str, output, stderr)
        self._cmd = cmd

    def __str__(self) -> str:
        return self._impl.__str__()

    @property
    def returncode(self) -> int:
        return self._impl.returncode

    @property
    def cmd(self) -> _CmdT:
        return self._cmd

    @property
    def output(self) -> Optional[str]:
        return self._impl.output

    @property
    def stderr(self) -> Optional[str]:
        return self._impl.stderr

    @property
    def stdout(self) -> Optional[str]:
        return self._impl.output
Esempio n. 2
0
 def __str__(self):
     s = CalledProcessError.__str__(self)
     s += ": %s" % (self.stderr)
     return s
Esempio n. 3
0
 def __str__(self):
     return '{}\nSTDOUT: {}\nSTDERR:{}'.format(
         CalledProcessError.__str__(self), self.output, self.error)
Esempio n. 4
0
 def __str__(self):
     return '{}\nSTDOUT: {}\nSTDERR:{}'.format(CalledProcessError.__str__(self),
                                               self.output, self.error)
Esempio n. 5
0
 def __str__(self):
     return CalledProcessError.__str__(self) + "\n%s" % self.out