[Pkg-bazaar-commits] ./bzr/unstable r687: - trap more errors from external commands
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 08:20:42 UTC 2009
------------------------------------------------------------
revno: 687
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Wed 2005-06-15 14:16:34 +1000
message:
- trap more errors from external commands
patch from mpe
modified:
bzrlib/commands.py
-------------- next part --------------
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2005-06-15 03:43:04 +0000
+++ b/bzrlib/commands.py 2005-06-15 04:16:34 +0000
@@ -259,17 +259,24 @@
def __init__(self, path):
self.path = path
- # TODO: If either of these fail, we should detect that and
- # assume that path is not really a bzr plugin after all.
-
pipe = os.popen('%s --bzr-usage' % path, 'r')
self.takes_options = pipe.readline().split()
+
+ for opt in self.takes_options:
+ if not opt in OPTIONS:
+ bailout("Unknown option '%s' returned by external command %s"
+ % (opt, path))
+
+ # TODO: Is there any way to check takes_args is valid here?
self.takes_args = pipe.readline().split()
- pipe.close()
+
+ if pipe.close() is not None:
+ bailout("Failed funning '%s --bzr-usage'" % path)
pipe = os.popen('%s --bzr-help' % path, 'r')
self.__doc__ = pipe.read()
- pipe.close()
+ if pipe.close() is not None:
+ bailout("Failed funning '%s --bzr-help'" % path)
def __call__(self, options, arguments):
Command.__init__(self, options, arguments)
More information about the Pkg-bazaar-commits
mailing list