Logo Search packages:      
Sourcecode: ubuntuone-dev-tools version File versions  Download package

def ubuntuone::devtools::services::dbus::DBusRunner::start_service (   self,
  tempdir = None 
)
Start our own session bus daemon for testing.

Definition at line 74 of file dbus.py.

                                         :
        """Start our own session bus daemon for testing."""
        if not tempdir:
            tempdir = os.path.join(os.getcwd(), '_trial_temp')
        dbus = find_executable("dbus-daemon")
        if not dbus:
            raise NotFoundError("dbus-daemon was not found.")

        self._find_config_file(tempdir)

        dbus_args = ["--fork",
                     "--config-file=" + self.config_file,
                     "--print-address=1",
                     "--print-pid=2"]
        sp = subprocess.Popen([dbus] + dbus_args,
                              bufsize=4096, stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE)

        # Call wait here as under the qt4 reactor we get an error about
        # interrupted system call if we don't.
        sp.wait()
        self.dbus_address = "".join(sp.stdout.readlines()).strip()
        self.dbus_pid = int("".join(sp.stderr.readlines()).strip())

        if self.dbus_address != "":
            os.environ["DBUS_SESSION_BUS_ADDRESS"] = self.dbus_address
        else:
            os.kill(self.dbus_pid, signal.SIGKILL)
            raise DBusLaunchError("There was a problem launching dbus-daemon.")
        self.running = True


Generated by  Doxygen 1.6.0   Back to index