'Parse arguments and run the script\'s main function via ``react``.'

def main(self):

    options = self._parse_options(self.sys_module.argv[1:])
    if self.logging:
        log_writer = eliot_logging_service(options.eliot_destination, self._reactor, True)
    else:
        log_writer = Service()
    log_writer.startService()
    def run_and_log(reactor):
        d = maybeDeferred(self.script.main, reactor, options)
        def got_error(failure):
            if failure.check(UsageError):
                err(failure.value.args)
                raise SystemExit(1)
            elif (not failure.check(SystemExit)):
                err(failure)
            return failure
        d.addErrback(got_error)
        return d
    try:
        self._react(run_and_log, [], _reactor=self._reactor)
    finally:
        log_writer.stopService()
