From f93090ee742714356a93751b41c6fcc19584b71b Mon Sep 17 00:00:00 2001 From: Davide Fissore Date: Tue, 26 Nov 2024 15:57:09 +0100 Subject: [PATCH] [test.real] command_exist --- tests/test.real.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test.real.ml b/tests/test.real.ml index 5fe767ae..6f372876 100644 --- a/tests/test.real.ml +++ b/tests/test.real.ml @@ -138,7 +138,9 @@ let print_csv plot results = end | None -> ()); close_out oc; - if Sys.command "which lua5.1 &>/dev/null" = 0 && Sys.command "which gnuplot &> /dev/null" = 0 then begin + let command_exists cmd = + Sys.command ("command -v " ^ cmd ^ " 2> /dev/null || exit 1 ") = 0 in + if command_exists "lua5.1" && command_exists "gnuplot" then begin ignore(Sys.command (plot ^ " data.csv")); ignore(Sys.command "gnuplot data.csv.plot") end