File 1491-Eliminate-use-of-old-catch-in-eunit.patch of Package erlang

From b3df833c00ef0c873f18b027f9a14a2525b111c7 Mon Sep 17 00:00:00 2001
From: Richard Carlsson <carlsson.richard@gmail.com>
Date: Sat, 7 Dec 2024 22:29:36 +0100
Subject: [PATCH 1/3] Eliminate use of old catch in eunit

---
 lib/eunit/src/Makefile         | 2 +-
 lib/eunit/src/eunit_server.erl | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/eunit/src/Makefile b/lib/eunit/src/Makefile
index f4eaf6807a..fd97abebe1 100644
--- a/lib/eunit/src/Makefile
+++ b/lib/eunit/src/Makefile
@@ -25,7 +25,7 @@ EBIN = ../ebin
 INCLUDE=../include
 
 ERL_COMPILE_FLAGS += -pa $(EBIN) -pa ../../stdlib/ebin -I$(INCLUDE) \
-	+nowarn_shadow_vars +warn_unused_import -Werror
+	 +warn_deprecated_catch +nowarn_shadow_vars +warn_unused_import -Werror
 
 PARSE_TRANSFORM = eunit_autoexport.erl
 
diff --git a/lib/eunit/src/eunit_server.erl b/lib/eunit/src/eunit_server.erl
index 936a4b7cd4..c4c139a5c2 100644
--- a/lib/eunit/src/eunit_server.erl
+++ b/lib/eunit/src/eunit_server.erl
@@ -202,7 +202,10 @@ server_command(From, {start, Job}, St) ->
 server_command(From, stop, St) ->
     %% unregister the server name and let remaining jobs finish
     server_command_reply(From, {error, stopped}),
-    catch unregister(St#state.name),
+    try unregister(St#state.name)
+    catch
+        error:badarg -> ok
+    end,
     server(St#state{stopped = true});
 server_command(From, {watch, Target, _Opts}, St) ->
     %% the code watcher is only started on demand
-- 
2.43.0

openSUSE Build Service is sponsored by