예제 #1
0
파일: server.py 프로젝트: rudresh2319/Xpra
    def kill_xvfb():
        # Close our display(s) first, so the server dying won't kill us.
        print("killing xvfb with pid %s" % xvfb_pid)
        for display in gtk.gdk.display_manager_get().list_displays():
            display.close()
        os.kill(xvfb_pid, signal.SIGTERM)

    if xvfb_pid is not None and not opts.use_display:
        _cleanups.append(kill_xvfb)

    from xpra.server import can_run_server, XpraServer
    if not can_run_server():
        return 1

    # This import is delayed because the module depends on gtk:
    app = XpraServer(clobber, sockets, opts)

    child_reaper = ChildReaper(app, opts.exit_with_children)
    # Always register the child reaper, because even if exit_with_children is
    # false, we still need to reap them somehow to avoid zombies:
    signal.signal(signal.SIGCHLD, child_reaper)
    if opts.exit_with_children:
        assert opts.children
    if opts.children:
        children_pids = set()
        for child_cmd in opts.children:
            try:
                children_pids.add(
                    subprocess.Popen(child_cmd, shell=True,
                                     close_fds=True).pid)
            except OSError, e:
예제 #2
0
파일: server.py 프로젝트: svn2github/Xpra
    def kill_xvfb():
        # Close our display(s) first, so the server dying won't kill us.
        print("killing xvfb with pid %s" % xvfb_pid)
        for display in gtk.gdk.display_manager_get().list_displays():
            display.close()
        if xvfb_pid is not None:
            os.kill(xvfb_pid, signal.SIGTERM)
    _cleanups.append(kill_xvfb)

    from xpra.server import can_run_server, XpraServer
    if not can_run_server():
        return  1

    # This import is delayed because the module depends on gtk:
    app = XpraServer(clobber, sockets, opts)

    child_reaper = ChildReaper(app, opts.exit_with_children)
    # Always register the child reaper, because even if exit_with_children is
    # false, we still need to reap them somehow to avoid zombies:
    signal.signal(signal.SIGCHLD, child_reaper)
    if opts.exit_with_children:
        assert opts.children
    if opts.children:
        children_pids = set()
        for child_cmd in opts.children:
            try:
                children_pids.add(subprocess.Popen(child_cmd, shell=True).pid)
            except OSError, e:
                sys.stderr.write("Error spawning child '%s': %s\n"
                                 % (child_cmd, e))
예제 #3
0
파일: server.py 프로젝트: rudresh2319/Xpra
            from wimpiggy.lowlevel import displayHasXComposite  #@UnresolvedImport
            # This import is delayed because the module depends on gtk:
            from xpra.server import XpraServer
        except ImportError, e:
            log.error(
                "Failed to load Xpra server components, check your installation: %s"
                % e)
            return 1
        root = gtk.gdk.get_default_root_window()
        if not displayHasXComposite(root):
            log.error(
                "Xpra is a compositing manager, it cannot use a display which lacks the XComposite extension!"
            )
            return 1

        app = XpraServer(clobber, sockets, opts)

    children_pids = set()

    def reaper_quit():
        if opts.exit_with_children:
            log.info(
                "all children have exited and --exit-with-children was specified, exiting"
            )
            app.quit(False)

    child_reaper = ChildReaper(reaper_quit, children_pids)
    procs = []
    if sys.version_info < (2, 7) or sys.version_info[:2] == (3, 0):
        POLL_DELAY = int(os.environ.get("XPRA_POLL_DELAY", 2))
        log.warn(