From 43ad5a2c353bdb30bb526416383c977e5f72b035 Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Sun, 2 Jun 2024 16:34:46 +0200 Subject: [PATCH] Fix to pass Eunit tests with Erlang/OTP 26 In Erlang 25 and older an unknown error message is formatted like this: 1> file:format_error(unexpected). "unknown POSIX error" However since Erlang 26 the result is different: 1> file:format_error(unexpected). "unknown POSIX error: unexpected" Let's add another case to handle both variants. Signed-off-by: Peter Lemenkov --- src/p1_file_queue.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/p1_file_queue.erl b/src/p1_file_queue.erl index 4f7745a..738635e 100644 --- a/src/p1_file_queue.erl +++ b/src/p1_file_queue.erl @@ -200,7 +200,9 @@ format_error({not_owner, Path}) -> "not a file queue owner (" ++ binary_to_list(Path) ++ ")"; format_error({Posix, Path}) -> case file:format_error(Posix) of - "unknown POSIX error" -> + "unknown POSIX error" -> % Erlang/OTP 25 and older + atom_to_list(Posix) ++ " (" ++ binary_to_list(Path) ++ ")"; + [$u, $n, $k, $n, $o, $w, $n | _] -> % Erlang/OTP 26 and newer atom_to_list(Posix) ++ " (" ++ binary_to_list(Path) ++ ")"; Reason -> Reason ++ " (" ++ binary_to_list(Path) ++ ")"