Raised when run() is called with check=True and the process returns a non-zero exit status. Attributes: cmd, returncode, stdout, stderr, output
| 124 | |
| 125 | |
| 126 | class CalledProcessError(SubprocessError): |
| 127 | """Raised when run() is called with check=True and the process |
| 128 | returns a non-zero exit status. |
| 129 | |
| 130 | Attributes: |
| 131 | cmd, returncode, stdout, stderr, output |
| 132 | """ |
| 133 | def __init__(self, returncode, cmd, output=None, stderr=None): |
| 134 | self.returncode = returncode |
| 135 | self.cmd = cmd |
| 136 | self.output = output |
| 137 | self.stderr = stderr |
| 138 | |
| 139 | def __str__(self): |
| 140 | if self.returncode and self.returncode < 0: |
| 141 | try: |
| 142 | return "Command '%s' died with %r." % ( |
| 143 | self.cmd, signal.Signals(-self.returncode)) |
| 144 | except ValueError: |
| 145 | return "Command '%s' died with unknown signal %d." % ( |
| 146 | self.cmd, -self.returncode) |
| 147 | else: |
| 148 | return "Command '%s' returned non-zero exit status %d." % ( |
| 149 | self.cmd, self.returncode) |
| 150 | |
| 151 | @property |
| 152 | def stdout(self): |
| 153 | """Alias for output attribute, to match stderr""" |
| 154 | return self.output |
| 155 | |
| 156 | @stdout.setter |
| 157 | def stdout(self, value): |
| 158 | # There's no obvious reason to set this, but allow it anyway so |
| 159 | # .stdout is a transparent alias for .output |
| 160 | self.output = value |
| 161 | |
| 162 | |
| 163 | class TimeoutExpired(SubprocessError): |
no outgoing calls
no test coverage detected