Commit ca0f8398 authored by maruel@chromium.org's avatar maruel@chromium.org

Make gclient_utils.CheckCallError inherit from subprocess2.CalledProcessError.

This will simply the transition

R=dpranke@chromium.org
BUG=
TEST=


Review URL: http://codereview.chromium.org/7839038

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@100174 0039d316-1c4b-4281-b951-d872f2087c98
parent 1ba646fc
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -15,6 +15,8 @@ import sys
import threading
import time
import subprocess2
def hack_subprocess():
"""subprocess functions may throw exceptions when used in multiple threads.
......@@ -29,28 +31,15 @@ class Error(Exception):
pass
class CheckCallError(OSError, Error):
class CheckCallError(subprocess2.CalledProcessError, Error):
"""CheckCall() returned non-0."""
def __init__(self, command, cwd, returncode, stdout, stderr=None):
OSError.__init__(self, command, cwd, returncode)
Error.__init__(self, command)
self.command = command
self.cwd = cwd
self.returncode = returncode
self.stdout = stdout
self.stderr = stderr
def __init__(self, cmd, cwd, returncode, stdout, stderr=None):
subprocess2.CalledProcessError.__init__(
self, returncode, cmd, cwd, stdout, stderr)
Error.__init__(self, cmd)
def __str__(self):
out = ' '.join(self.command)
if self.cwd:
out += ' in ' + self.cwd
if self.returncode is not None:
out += ' returned %d' % self.returncode
if self.stdout is not None:
out += '\nstdout: %s\n' % self.stdout
if self.stderr is not None:
out += '\nstderr: %s\n' % self.stderr
return out
return subprocess2.CalledProcessError.__str__(self)
def Popen(args, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment