Skip to content

Commit

Permalink
fix: Avoid using lsof -Q which is only available from lsof 4.95.0
Browse files Browse the repository at this point in the history
(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.
  • Loading branch information
erikmd authored and AltGr committed Feb 9, 2024
1 parent 6e9cd2b commit a242084
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/server/learnocaml_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a242084

Please sign in to comment.