File 9091-Remove-catch-in-os.patch of Package erlang

From 0f8ce87bb2e62bd752a44b69f5489806dec9977f Mon Sep 17 00:00:00 2001
From: Maria Scott <maria-12648430@hnc-agency.org>
Date: Tue, 10 Mar 2026 18:19:20 +0100
Subject: [PATCH] Remove catch in os

---
 lib/kernel/src/os.erl        | 4 +---
 lib/kernel/test/os_SUITE.erl | 6 +++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl
index 7c9ec802c9..0cd52c4cfe 100644
--- a/lib/kernel/src/os.erl
+++ b/lib/kernel/src/os.erl
@@ -728,7 +726,7 @@ get_data(Port, MonRef, Eot, Sofar, Size, Max, ExitStatus) ->
                     get_data(Port, MonRef, Eot, [Sofar, Bytes],
                              Size + byte_size(Bytes), Max);
                 Last ->
-                    catch port_close(Port),
+                    try port_close(Port) catch _:_ -> true end,
                     flush_until_down(Port, MonRef),
                     iolist_to_binary([Sofar, Last])
             end;
diff --git a/lib/kernel/test/os_SUITE.erl b/lib/kernel/test/os_SUITE.erl
index 84583d08ab..3daf906e7f 100644
--- a/lib/kernel/test/os_SUITE.erl
+++ b/lib/kernel/test/os_SUITE.erl
@@ -200,10 +200,10 @@ space_in_name(Config) when is_list(Config) ->
     [] = receive_all(),
     ok.
 
-%% Check that a bad command doesn't crasch the server or the emulator (it used to).
+%% Check that a bad command doesn't crash the server or the emulator (it used to).
 bad_command(Config) when is_list(Config) ->
-    catch os:cmd([a|b]),
-    catch os:cmd({bad, thing}),
+    ok = ?assertError(badarg, os:cmd([a|b])),
+    ok = ?assertError(badarg, os:cmd({bad, thing})),
 
     %% This should at least not crash (on Unix it typically returns
     %% a message from the shell).
-- 
2.51.0

openSUSE Build Service is sponsored by