diff options
author | Guido Günther <agx@sigxcpu.org> | 2009-08-22 15:03:42 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-08-23 17:28:49 +0200 |
commit | a4fd8ebf6b7a7fbc8abc5a1a3260dca759f88c3f (patch) | |
tree | 569ff82caf695728e61e0bf1b9da7494c063d73c /gbp/command_wrappers.py | |
parent | 4cd72bc7efc04fddf39b208b3d0bb7293bc904d9 (diff) |
add doctest for Command.call()
and fix error in exception handling revealed by the test.
Diffstat (limited to 'gbp/command_wrappers.py')
-rw-r--r-- | gbp/command_wrappers.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py index b73549b..6487489 100644 --- a/gbp/command_wrappers.py +++ b/gbp/command_wrappers.py @@ -83,11 +83,18 @@ class Command(object): raise CommandExecFailed def call(self, args): - """like __call__ but don't use stderr and let the caller handle the return status""" + """like __call__ but don't use stderr and let the caller handle the return status + >>> Command("/bin/true").call(["foo", "bar"]) + 0 + >>> Command("/foo/bar").call(["foo", "bar"]) # doctest:+ELLIPSIS + Traceback (most recent call last): + ... + CommandExecFailed: Execution failed: ... + """ try: ret = self.__call(args) except OSError, e: - raise CommandExecFailed, "Execution failed:", e + raise CommandExecFailed, "Execution failed: %s" % e return ret |