Commit 2781e626 authored by morrita@google.com's avatar morrita@google.com

2011-04-05 MORITA Hajime <morrita@google.com>

        Reviewed by Adam Barth.

        webkit-patch should print git's stderr when git svn dcommit fail
        http://webkit.org/b/57861

        * Scripts/webkitpy/common/checkout/scm.py:

git-svn-id: svn://svn.chromium.org/blink/trunk@82978 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c2c97c71
2011-04-05 MORITA Hajime <morrita@google.com>
Reviewed by Adam Barth.
webkit-patch should print git's stderr when git svn dcommit fail
http://webkit.org/b/57861
* Scripts/webkitpy/common/checkout/scm.py:
2011-04-05 Mihai Parparita <mihaip@chromium.org> 2011-04-05 Mihai Parparita <mihaip@chromium.org>
Reviewed by Tony Chang. Reviewed by Tony Chang.
......
...@@ -81,6 +81,11 @@ class ScriptError(Exception): ...@@ -81,6 +81,11 @@ class ScriptError(Exception):
self.output = output self.output = output
self.cwd = cwd self.cwd = cwd
def __str__(self):
if self.output:
return self.message + "\n" + self.output
return self.message
def message_with_output(self, output_limit=500): def message_with_output(self, output_limit=500):
if self.output: if self.output:
if output_limit and len(self.output) > output_limit: if output_limit and len(self.output) > output_limit:
......
...@@ -199,3 +199,18 @@ class ExecutiveTest(unittest.TestCase): ...@@ -199,3 +199,18 @@ class ExecutiveTest(unittest.TestCase):
self.assertTrue(executive.check_running_pid(os.getpid())) self.assertTrue(executive.check_running_pid(os.getpid()))
# Maximum pid number on Linux is 32768 by default # Maximum pid number on Linux is 32768 by default
self.assertFalse(executive.check_running_pid(100000)) self.assertFalse(executive.check_running_pid(100000))
class ScriptErrorTest(unittest.TestCase):
def test_str_with_message(self):
try:
raise ScriptError(message="message")
except ScriptError, e:
self.assertEqual(str(e), "message")
def test_str_without_message(self):
try:
raise ScriptError(script_args=["echo", "hello"], exit_code=1, cwd="./", output="Out")
except ScriptError, e:
self.assertEqual(str(e), "Failed to run \"['echo', 'hello']\" exit_code: 1 cwd: ./\nOut""")
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