def run(self, args, config):
        def on_sigterm(loop):
            logger.info('GLib mainloop got SIGTERM. Exiting...')
            loop.quit()

        loop = GLib.MainLoop()
        GLib.unix_signal_add(
            GLib.PRIORITY_DEFAULT, signal.SIGTERM, on_sigterm, loop)

        mixer_class = self.get_mixer_class(config, args.registry['mixer'])
        backend_classes = args.registry['backend']
        frontend_classes = args.registry['frontend']

        exit_status_code = 0
        try:
            mixer = None
            if mixer_class is not None:
                mixer = self.start_mixer(config, mixer_class)
            if mixer:
                self.configure_mixer(config, mixer)
            audio = self.start_audio(config, mixer)
            backends = self.start_backends(config, backend_classes, audio)
            core = self.start_core(config, mixer, backends, audio)
            self.start_frontends(config, frontend_classes, core)
            logger.info('Starting GLib mainloop')
            loop.run()
        except (exceptions.BackendError,
                exceptions.FrontendError,
                exceptions.MixerError):
            logger.info('Initialization error. Exiting...')
            exit_status_code = 1
        except __HOLE__:
            logger.info('Interrupted. Exiting...')
        except Exception:
            logger.exception('Uncaught exception')
        finally:
            loop.quit()
            self.stop_frontends(frontend_classes)
            self.stop_core()
            self.stop_backends(backend_classes)
            self.stop_audio()
            if mixer_class is not None:
                self.stop_mixer(mixer_class)
            process.stop_remaining_actors()
            return exit_status_code
dataset/ETHPy150Open mopidy/mopidy/mopidy/commands.py/RootCommand.run