/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2005-06-15 04:16:34 UTC
  • Revision ID: mbp@sourcefrog.net-20050615041634-a52454b7eb0a6920
- trap more errors from external commands
  patch from mpe

Show diffs side-by-side

added added

removed removed

Lines of Context:
259
259
    def __init__(self, path):
260
260
        self.path = path
261
261
 
262
 
        # TODO: If either of these fail, we should detect that and
263
 
        # assume that path is not really a bzr plugin after all.
264
 
 
265
262
        pipe = os.popen('%s --bzr-usage' % path, 'r')
266
263
        self.takes_options = pipe.readline().split()
 
264
 
 
265
        for opt in self.takes_options:
 
266
            if not opt in OPTIONS:
 
267
                bailout("Unknown option '%s' returned by external command %s"
 
268
                    % (opt, path))
 
269
 
 
270
        # TODO: Is there any way to check takes_args is valid here?
267
271
        self.takes_args = pipe.readline().split()
268
 
        pipe.close()
 
272
 
 
273
        if pipe.close() is not None:
 
274
            bailout("Failed funning '%s --bzr-usage'" % path)
269
275
 
270
276
        pipe = os.popen('%s --bzr-help' % path, 'r')
271
277
        self.__doc__ = pipe.read()
272
 
        pipe.close()
 
278
        if pipe.close() is not None:
 
279
            bailout("Failed funning '%s --bzr-help'" % path)
273
280
 
274
281
    def __call__(self, options, arguments):
275
282
        Command.__init__(self, options, arguments)