From a242084cde9eaf4ab25b205b71c244c23279704f Mon Sep 17 00:00:00 2001 From: Erik Martin-Dorel Date: Fri, 9 Feb 2024 13:15:16 +0100 Subject: [PATCH] fix: Avoid using `lsof -Q` which is only available from lsof 4.95.0 (Debian 11 (oldstable) and Ubuntu 22.04 LTS both have lsof 4.93.2.) The only drawback we could expect is generating a nonzero exit code, but the current implementation with Unix.open_process_in works as is. --- src/server/learnocaml_server.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/learnocaml_server.ml b/src/server/learnocaml_server.ml index 1a4c7664f..f6a61e5b3 100644 --- a/src/server/learnocaml_server.ml +++ b/src/server/learnocaml_server.ml @@ -718,7 +718,7 @@ let launch () = let check_running () = try - let ic = Printf.ksprintf Unix.open_process_in "lsof -Qti tcp:%d -s tcp:LISTEN" !port in + let ic = Printf.ksprintf Unix.open_process_in "lsof -ti tcp:%d -s tcp:LISTEN" !port in let pid = match input_line ic with | "" -> None | s -> int_of_string_opt s