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