Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang
erlang
1925-stdlib-Fix-ancestors-for-group-and-shell.p...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1925-stdlib-Fix-ancestors-for-group-and-shell.patch of Package erlang
From 516b3bfebb16116f93856c134d0c19fba0492f9f Mon Sep 17 00:00:00 2001 From: Lukas Larsson <lukas@erlang.org> Date: Wed, 8 Jun 2022 21:28:04 +0200 Subject: [PATCH 05/34] stdlib: Fix ancestors for group and shell This makes observer better at drawing the application tree --- lib/kernel/src/group.erl | 11 ++++++++--- lib/stdlib/src/shell.erl | 9 ++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/kernel/src/group.erl b/lib/kernel/src/group.erl index f8ce13e947..73434984f1 100644 --- a/lib/kernel/src/group.erl +++ b/lib/kernel/src/group.erl @@ -21,16 +21,21 @@ %% A group leader process for user io. --export([start/2, start/3, server/3]). +-export([start/2, start/3, server/4]). start(Drv, Shell) -> start(Drv, Shell, []). start(Drv, Shell, Options) -> - spawn_link(group, server, [Drv, Shell, Options]). + Ancestors = [self() | case get('$ancestors') of + undefined -> []; + Anc -> Anc + end], + spawn_link(group, server, [Ancestors, Drv, Shell, Options]). -server(Drv, Shell, Options) -> +server(Ancestors, Drv, Shell, Options) -> process_flag(trap_exit, true), + _ = [put('$ancestors', Ancestors) || Shell =/= {}], edlin:init(), put(line_buffer, proplists:get_value(line_buffer, Options, group_history:load())), put(read_mode, list), diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl index c3d9c83a66..c62d5a45d2 100644 --- a/lib/stdlib/src/shell.erl +++ b/lib/stdlib/src/shell.erl @@ -59,7 +59,14 @@ start(NoCtrlG) -> start(NoCtrlG, StartSync) -> _ = code:ensure_loaded(user_default), - spawn(fun() -> server(NoCtrlG, StartSync) end). + Ancestors = [self() | case get('$ancestors') of + undefined -> []; + Anc -> Anc + end], + spawn(fun() -> + put('$ancestors', Ancestors), + server(NoCtrlG, StartSync) + end). %% Call this function to start a user restricted shell %% from a normal shell session. -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor