MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / CalledProcessError

Class CalledProcessError

tools/python-3.11.9-amd64/Lib/subprocess.py:126–160  ·  view source on GitHub ↗

Raised when run() is called with check=True and the process returns a non-zero exit status. Attributes: cmd, returncode, stdout, stderr, output

Source from the content-addressed store, hash-verified

124
125
126class 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
163class TimeoutExpired(SubprocessError):

Callers 3

check_callFunction · 0.85
check_returncodeMethod · 0.85
runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected