def run_proxy(parser, opts, extra_args): from xpra.proxy import XpraProxy assert "gtk" not in sys.modules server_conn = connect_or_fail(pick_display(parser, opts, extra_args)) app = XpraProxy(TwoFileConnection(sys.stdout, sys.stdin), server_conn) app.run() return 0
def run_proxy(parser, opts, extra_args): from xpra.proxy import XpraProxy assert "gtk" not in sys.modules server_conn = connect_or_fail(pick_display(parser, opts, extra_args)) app = XpraProxy(TwoFileConnection(sys.stdout, sys.stdin), server_conn) app.run() return 0
def run_proxy(parser, opts, script_file, args, start_server=False): from xpra.proxy import XpraProxy assert "gtk" not in sys.modules if start_server: assert len(args) == 1 display_name = args[0] #we must use a subprocess to avoid messing things up - yuk cmd = [script_file, "start"] + args if opts.start_child and len(opts.start_child) > 0: for x in opts.start_child: cmd.append("--start-child=%s" % x) if opts.exit_with_children: cmd.append("--exit-with-children") def setsid(): os.setsid() Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, preexec_fn=setsid) dotxpra = DotXpra() start = time.time() while dotxpra.server_state(display_name, 1) != DotXpra.LIVE: if time.time() - start > 5: warn("server failed to start after %.1f seconds - sorry!" % (time.time() - start)) return time.sleep(0.10) server_conn = connect_or_fail(pick_display(parser, opts, args)) app = XpraProxy( TwoFileConnection(sys.stdout, sys.stdin, info="stdin/stdout"), server_conn) signal.signal(signal.SIGINT, app.quit) signal.signal(signal.SIGTERM, app.quit) app.run() return 0
def run_proxy(parser, opts, script_file, args, start_server=False): from xpra.proxy import XpraProxy assert "gtk" not in sys.modules if start_server: assert len(args)==1 display_name = args[0] #we must use a subprocess to avoid messing things up - yuk cmd = [script_file, "start"]+args if opts.start_child and len(opts.start_child)>0: for x in opts.start_child: cmd.append("--start-child=%s" % x) if opts.exit_with_children: cmd.append("--exit-with-children") def setsid(): os.setsid() Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, preexec_fn=setsid) dotxpra = DotXpra() start = time.time() while dotxpra.server_state(display_name, 1)!=DotXpra.LIVE: if time.time()-start>5: warn("server failed to start after %.1f seconds - sorry!" % (time.time()-start)) return time.sleep(0.10) server_conn = connect_or_fail(pick_display(parser, opts, args)) app = XpraProxy(TwoFileConnection(sys.stdout, sys.stdin, info="stdin/stdout"), server_conn) signal.signal(signal.SIGINT, app.quit) signal.signal(signal.SIGTERM, app.quit) app.run() return 0
def run_proxy(parser, opts, extra_args): from xpra.proxy import XpraProxy assert "gtk" not in sys.modules server_conn = connect_or_fail(pick_display(parser, opts, extra_args)) app = XpraProxy(TwoFileConnection(sys.stdout, sys.stdin, info="stdin/stdout"), server_conn) signal.signal(signal.SIGINT, app.quit) signal.signal(signal.SIGTERM, app.quit) app.run() return 0
def run_proxy(parser, opts, extra_args): from xpra.proxy import XpraProxy app = XpraProxy(0, 1, client_sock(parser, opts, pick_display(parser, extra_args))[0]) app.run()