Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        def run_server(project_dir, executable=None, env=None):
    import os.path, time
    from subprocess import Popen
    from multiprocessing.connection import Client, arbitrary_address

    addr = arbitrary_address('AF_UNIX')

    executable = executable or sys.executable
    args = [executable, __file__, addr]

    environ = None
    if env:
        environ = os.environ.copy()
        environ.update(env)

    proc = Popen(args, cwd=project_dir, env=environ)
    start = time.time()
    while not os.path.exists(addr):
        if time.time() - start > 5:
            raise Exception('py.test launching timeout exceed')
        time.sleep(0.01)

    conn = Client(addr)

    return proc, conn
        


src/s/n/snaked-HEAD/snaked/plugins/python_repl/__init__.py   snaked(Download)
def get_server_conn(editor):
    global server
    if not server:
        from .executor import run_server
        from ..python.utils import get_executable
        root = editor.project_root
        if not root:
            root = os.path.dirname(editor.uri)
        server = run_server(root, get_executable(editor.conf))