From 4fc45560ed8b7c2b10c7e4f23bfaa8837b90a955 Mon Sep 17 00:00:00 2001 From: Nfsaavedra Date: Wed, 8 Nov 2023 18:37:19 +0000 Subject: [PATCH 1/2] Remove memory limit for MacOS since ulimit does not work --- coq/lsp/client.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/coq/lsp/client.py b/coq/lsp/client.py index 465750e..65541b1 100644 --- a/coq/lsp/client.py +++ b/coq/lsp/client.py @@ -1,3 +1,4 @@ +import sys import time import subprocess from lsp.json_rpc_endpoint import JsonRpcEndpoint @@ -38,7 +39,7 @@ def __init__( timeout (int, optional): Timeout used for the coq-lsp operations. Defaults to 2. memory_limit (int, optional): RAM limit for the coq-lsp process - in kbytes. Defaults to 2097152. + in kbytes. It only works for Linux systems. Defaults to 2097152. coq_lsp(str, optional): Path to the coq-lsp binary. Defaults to "coq-lsp". init_options (Dict, optional): Initialization options for coq-lsp server. Available options are: @@ -57,8 +58,14 @@ def __init__( Defaults to 1. """ self.file_progress: Dict[str, List[CoqFileProgressParams]] = {} + + if sys.platform.startswith("linux"): + command = f"ulimit -v {memory_limit}; {coq_lsp}" + else: + command = coq_lsp + proc = subprocess.Popen( - f"ulimit -v {memory_limit}; {coq_lsp}", + command, stdout=subprocess.PIPE, stdin=subprocess.PIPE, shell=True, From 1cde6737bcf61a0453156d446e32336ff3b65e81 Mon Sep 17 00:00:00 2001 From: Nfsaavedra Date: Tue, 14 Nov 2023 11:08:36 +0000 Subject: [PATCH 2/2] black --- coq/lsp/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coq/lsp/client.py b/coq/lsp/client.py index 65541b1..70e3f49 100644 --- a/coq/lsp/client.py +++ b/coq/lsp/client.py @@ -62,7 +62,7 @@ def __init__( if sys.platform.startswith("linux"): command = f"ulimit -v {memory_limit}; {coq_lsp}" else: - command = coq_lsp + command = coq_lsp proc = subprocess.Popen( command,