A process that has finished running. This is returned by run(). Attributes: args: The list or str args passed to run(). returncode: The exit code of the process, negative for signals. stdout: The standard output (None if not captured). stderr: The standard error (No
| 474 | |
| 475 | |
| 476 | class CompletedProcess(object): |
| 477 | """A process that has finished running. |
| 478 | |
| 479 | This is returned by run(). |
| 480 | |
| 481 | Attributes: |
| 482 | args: The list or str args passed to run(). |
| 483 | returncode: The exit code of the process, negative for signals. |
| 484 | stdout: The standard output (None if not captured). |
| 485 | stderr: The standard error (None if not captured). |
| 486 | """ |
| 487 | def __init__(self, args, returncode, stdout=None, stderr=None): |
| 488 | self.args = args |
| 489 | self.returncode = returncode |
| 490 | self.stdout = stdout |
| 491 | self.stderr = stderr |
| 492 | |
| 493 | def __repr__(self): |
| 494 | args = ['args={!r}'.format(self.args), |
| 495 | 'returncode={!r}'.format(self.returncode)] |
| 496 | if self.stdout is not None: |
| 497 | args.append('stdout={!r}'.format(self.stdout)) |
| 498 | if self.stderr is not None: |
| 499 | args.append('stderr={!r}'.format(self.stderr)) |
| 500 | return "{}({})".format(type(self).__name__, ', '.join(args)) |
| 501 | |
| 502 | __class_getitem__ = classmethod(types.GenericAlias) |
| 503 | |
| 504 | |
| 505 | def check_returncode(self): |
| 506 | """Raise CalledProcessError if the exit code is non-zero.""" |
| 507 | if self.returncode: |
| 508 | raise CalledProcessError(self.returncode, self.args, self.stdout, |
| 509 | self.stderr) |
| 510 | |
| 511 | |
| 512 | def run(*popenargs, |
no outgoing calls
no test coverage detected
searching dependent graphs…