aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-12-29 20:49:03 +0100
committerGuido Günther <agx@sigxcpu.org>2010-12-29 20:54:57 +0100
commitd5230651d108dabbe632b505dc0c89bc77ff561c (patch)
tree94fa94e244270a10a361ef443874c5f0491fe515 /gbp
parent31b485437e042fd1fa92dc89ce06e0629671437e (diff)
Use logging functions
Diffstat (limited to 'gbp')
-rw-r--r--gbp/command_wrappers.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/gbp/command_wrappers.py b/gbp/command_wrappers.py
index 60a317f8..28f62a0a 100644
--- a/gbp/command_wrappers.py
+++ b/gbp/command_wrappers.py
@@ -7,7 +7,6 @@ git-buildpackage and friends
"""
import subprocess
-import sys
import os
import os.path
import signal
@@ -51,25 +50,25 @@ class Command(object):
"""
run self.cmd adding args as additional arguments
- be verbose about errors and encode them in the return value, don't pass
- on exceptions
+ Be verbose about errors and encode them in the return value, don't pass
+ on exceptions.
"""
try:
retcode = self.__call(args)
if retcode < 0:
- print >>sys.stderr, "%s was terminated by signal %d" % (self.cmd, -retcode)
+ log.err("%s was terminated by signal %d" % (self.cmd, -retcode))
elif retcode > 0:
- print >>sys.stderr, "%s returned %d" % (self.cmd, retcode)
+ log.err("%s returned %d" % (self.cmd, retcode))
except OSError, e:
- print >>sys.stderr, "Execution failed:", e
+ log.err("Execution failed: " + e.__str__())
retcode = 1
if retcode:
- print >>sys.stderr, self.run_error
+ log.err(self.run_error)
return retcode
def __call__(self, args=[]):
- """run the command, convert all errors into CommandExecFailed, assumes
- that the lower levels printed an error message - only usefull if you
+ """Run the command, convert all errors into CommandExecFailed, assumes
+ that the lower levels printed an error message - only useful if you
only expect 0 as result
>>> Command("/bin/true")(["foo", "bar"])
>>> Command("/foo/bar")()