File 0438-fixup-dbg-isShell-check-when-ancestors-empty.patch of Package erlang

From ede08117ec01f66b9cff2cce44176514412bc0fd Mon Sep 17 00:00:00 2001
From: Fredrik Frantzen <frazze@erlang.org>
Date: Mon, 26 May 2025 10:02:27 +0200
Subject: [PATCH 2/2] fixup! dbg: isShell check when ancestors empty

---
 lib/runtime_tools/src/dbg.erl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/runtime_tools/src/dbg.erl b/lib/runtime_tools/src/dbg.erl
index a7784dc6c3..0a7c9ea3c9 100644
--- a/lib/runtime_tools/src/dbg.erl
+++ b/lib/runtime_tools/src/dbg.erl
@@ -2382,8 +2382,10 @@ dhandler_default_out() ->
     %% When user (human) sets up dbg over remsh, group_leader is on other node.
     %% In this case, pass printed info to the remote group_leader
     %% so the user (human) can see what's happening
-    {_Key, Ancestors} = process_info(self(), {dictionary, '$ancestors'}),
-    IsShell = (shell:whereis() == hd(Ancestors)),
+    IsShell = case process_info(self(), {dictionary, '$ancestors'}) of
+        {_Key, [Shell | _]} -> (shell:whereis() == Shell);
+        _ -> false
+    end,
     case IsShell andalso (node(group_leader()) /= node()) of
         true ->
             % This is an interactive shell AND group_leader is remote
-- 
2.43.0

openSUSE Build Service is sponsored by