return subprocess.CompletedProcess-like object
Markus Gerstel
2 years ago
329 | 329 | return command |
330 | 330 | |
331 | 331 | |
332 | if sys.version_info < (3, 5): | |
333 | ||
334 | class _ReturnObjectParent(object): | |
335 | def check_returncode(self): | |
336 | if self.returncode: | |
337 | raise Exception( | |
338 | "Call %r resulted in non-zero exit code %r" | |
339 | % (self.args, self.returncode) | |
340 | ) | |
341 | ||
342 | ||
343 | else: | |
344 | _ReturnObjectParent = subprocess.CompletedProcess | |
345 | ||
346 | ||
347 | class ReturnObject(dict, _ReturnObjectParent): | |
332 | class ReturnObject(dict, subprocess.CompletedProcess): | |
348 | 333 | """ |
349 | 334 | A subprocess.CompletedProcess-like object containing the executed |
350 | 335 | command, stdout and stderr (both as bytestrings), and the exitcode. |