예제 #1
0
파일: lspcommand.py 프로젝트: zjsxwc/hhvm
    def create(cls: Type[U], env: Mapping[str, str],
               use_serverless_ide: bool) -> Iterator[U]:
        args = ["--enhanced-hover"]
        if use_serverless_ide:
            args.append("--serverless-ide")
        proc = subprocess.Popen(
            [hh_client, "lsp"] + args,
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=None,  # so hh_client inherits (=> writes to) our own stderr
            env=env,
        )

        # Use the unbuffered versions of these streams, as the buffered versions
        # of these streams sometimes cause deadlocks when accessed from multiple
        # threads.
        stdin = proc.stdin.detach()  # pyre-ignore
        stdout = proc.stdout.detach()
        try:
            reader = JsonRpcStreamReader(stdout)
            writer = JsonRpcStreamWriter(stdin)
            yield cls(proc, reader, writer)
        finally:
            stdin.close()
            stdout.close()
예제 #2
0
파일: lspcommand.py 프로젝트: subvin/hhvm
 def create(cls, env):
     proc = subprocess.Popen([hh_client, 'lsp', '--enhanced-hover'],
                             stdin=subprocess.PIPE,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE,
                             env=env)
     try:
         reader = JsonRpcStreamReader(proc.stdout)
         writer = JsonRpcStreamWriter(proc.stdin)
         yield cls(proc, reader, writer)
     finally:
         proc.stdin.close()
         proc.stdout.close()
         proc.stderr.close()
예제 #3
0
파일: lspcommand.py 프로젝트: symisc/phvm
 def create(cls: Type[U], env: Mapping[str, str]) -> Iterator[U]:
     proc = subprocess.Popen(
         [hh_client, "lsp", "--enhanced-hover"],
         stdin=subprocess.PIPE,
         stdout=subprocess.PIPE,
         stderr=subprocess.PIPE,
         env=env,
     )
     try:
         reader = JsonRpcStreamReader(proc.stdout)
         writer = JsonRpcStreamWriter(proc.stdin)
         yield cls(proc, reader, writer)
     finally:
         proc.stdin.close()
         proc.stdout.close()
         proc.stderr.close()
예제 #4
0
    def create(cls):
        # yes shell = True is generally a bad idea, but
        # in this case we want to pick up your environment entirely because
        # hack depends heavily on it to work
        proc = subprocess.Popen('hh_client lsp',
                                shell=True,
                                stdin=subprocess.PIPE,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.PIPE)

        reader = JsonRpcStreamReader(proc.stdout)
        writer = JsonRpcStreamWriter(proc.stdin)
        yield cls(proc, reader, writer)

        proc.stdin.close()
        proc.stdout.close()
        proc.stderr.close()
예제 #5
0
 def create(cls: Type[U], env: Mapping[str, str],
            use_serverless_ide: bool) -> Iterator[U]:
     args = ["--enhanced-hover"]
     if use_serverless_ide:
         args.append("--serverless-ide")
     proc = subprocess.Popen(
         [hh_client, "lsp"] + args,
         stdin=subprocess.PIPE,
         stdout=subprocess.PIPE,
         stderr=subprocess.PIPE,
         env=env,
     )
     try:
         stdout: BinaryIO = proc.stdout  # pyre-ignore
         stdin: BinaryIO = proc.stdin  # pyre-ignore
         reader = JsonRpcStreamReader(stdout)
         writer = JsonRpcStreamWriter(stdin)
         yield cls(proc, reader, writer)
     finally:
         proc.stdin.close()
         proc.stdout.close()
         proc.stderr.close()