From c9a3fd7c8ccd9055b848347b31076bdbd5370451 Mon Sep 17 00:00:00 2001 From: zmstone Date: Sat, 31 Aug 2024 09:12:15 +0200 Subject: [PATCH] chore: fail with more readable error if fdb is not installed --- rebar.config.script | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/rebar.config.script b/rebar.config.script index 4a07085..ca520ac 100644 --- a/rebar.config.script +++ b/rebar.config.script @@ -3,10 +3,15 @@ MaxAPIVersion = begin VsnInfo = os:cmd("fdbcli --version"), - {match, [ProtocolStr]} = re:run(VsnInfo, "protocol ([a-f0-9]*)", [{capture, [1], list}]), - ProtocolVsn = list_to_integer(ProtocolStr, 16), - APIVersionBytes = (ProtocolVsn band 16#0000000FFF00000) bsr 20, - integer_to_list(APIVersionBytes, 16) + case re:run(VsnInfo, "protocol ([a-f0-9]*)", [{capture, [1], list}]) of + {match, [ProtocolStr]} -> + ProtocolVsn = list_to_integer(ProtocolStr, 16), + APIVersionBytes = (ProtocolVsn band 16#0000000FFF00000) bsr 20, + integer_to_list(APIVersionBytes, 16); + _ -> + io:format(user, "fdbcli is not installed~n", []), + halt(1) + end end. % https://github.com/markusn/coveralls-erl#example-usage-rebar3-and-github-actions