Ticket #6460: twistd-subcommand-errors-6460.patch

File twistd-subcommand-errors-6460.patch, 1.2 KB (added by Richard Wall, 9 years ago)

An untested idea for a fix

  • twisted/application/app.py

     
    621621            try:
    622622                self['logger'] = namedAny(self['logger'])
    623623            except Exception, e:
    624                 raise usage.UsageError("Logger '%s' could not be imported: %s" 
     624                raise usage.UsageError("Logger '%s' could not be imported: %s"
    625625                                       % (self['logger'], e))
    626626
    627627
     
    646646    try:
    647647        config.parseOptions()
    648648    except usage.error, ue:
     649        commandChain = [sys.argv[0]]
     650        commandConfig = config
     651        while commandConfig.subCommand:
     652            commandChain.append(commandConfig.subCommand)
     653            commandConfig = commandConfig.subOptions
    649654        print config
    650         print "%s: %s" % (sys.argv[0], ue)
     655        print "%s: %s" % (' '.join(commandChain), ue)
    651656    else:
    652657        runApp(config)
    653658
     
    671676         reactor.addSystemEventTrigger('after', 'shutdown', p.save, 'shutdown')
    672677    reactor.addSystemEventTrigger('before', 'shutdown',
    673678                                  service.IService(application).stopService)
    674