Skip to content

Commit

Permalink
Fix to pass Eunit tests with Erlang/OTP 26
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
lemenkov committed Jun 21, 2024
1 parent ba81675 commit 43ad5a2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/p1_file_queue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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) ++ ")"
Expand Down

0 comments on commit 43ad5a2

Please sign in to comment.