diff --git a/lib/kernel/src/group.erl b/lib/kernel/src/group.erl index 64ecda71719c..f256b2fd2d50 100644 --- a/lib/kernel/src/group.erl +++ b/lib/kernel/src/group.erl @@ -47,7 +47,6 @@ 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), put(user_drv, Drv), @@ -66,6 +65,16 @@ server(Ancestors, Drv, Shell, Options) -> %% expand_below can be set by user_drv and ssh_cli put(expand_below, proplists:get_value(expand_below, Options, true)), + DefaultGroupHistory = + case not get(echo) of + true -> + []; + false -> + group_history:load() + end, + + put(line_buffer, proplists:get_value(line_buffer, Options, DefaultGroupHistory)), + server_loop(Drv, start_shell(Shell), []). whereis_shell() -> diff --git a/lib/kernel/test/init_SUITE.erl b/lib/kernel/test/init_SUITE.erl index ca4a79acfa65..4bec6e02a9ea 100644 --- a/lib/kernel/test/init_SUITE.erl +++ b/lib/kernel/test/init_SUITE.erl @@ -27,7 +27,7 @@ -export([get_arguments/1, get_argument/1, boot_var/1, restart/1, many_restarts/0, many_restarts/1, restart_with_mode/1, - get_plain_arguments/1, + get_plain_arguments/1, init_group_history_deadlock/1, reboot/1, stop_status/1, stop/1, get_status/1, script_id/1, dot_erlang/1, unknown_module/1, dash_S/1, dash_extra/1, dash_run/1, dash_s/1, @@ -51,7 +51,8 @@ suite() -> all() -> [get_arguments, get_argument, boot_var, many_restarts, restart_with_mode, - get_plain_arguments, restart, stop_status, get_status, script_id, + get_plain_arguments, init_group_history_deadlock, + restart, stop_status, get_status, script_id, dot_erlang, unknown_module, {group, boot}, dash_S, dash_extra, dash_run, dash_s]. @@ -228,6 +229,17 @@ get_plain_arguments(Config) when is_list(Config) -> ok. +init_group_history_deadlock(_Config) -> + Output = os:cmd(ct:get_progname() ++ " -noshell -eval \"logger:warning(\\\"testing\\\")\" " + "-inets services crashme -eval \"application:start(inets, permanent).\" "), + + io:format("Got output: ~ts~n",[Output]), + + case string:find(Output, "removed_failing_handler") of + nomatch -> ok; + _ -> ct:fail("Found unexpected printout in log") + end. + %% ------------------------------------------------ %% Use -boot_var flag to set $TEST_VAR in boot script. %% ------------------------------------------------