From 7f62a44082b674b82f4c30fbb3ece6003cae223c Mon Sep 17 00:00:00 2001 From: Duncan McGreggor Date: Sat, 5 Aug 2023 15:37:24 -0500 Subject: [PATCH 1/6] Ensure an Erlang 26 custom shell's args are passed. --- apps/rebar/src/rebar_prv_shell.erl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/rebar/src/rebar_prv_shell.erl b/apps/rebar/src/rebar_prv_shell.erl index 087aa1ad5..c2b09e17e 100644 --- a/apps/rebar/src/rebar_prv_shell.erl +++ b/apps/rebar/src/rebar_prv_shell.erl @@ -168,11 +168,11 @@ setup_shell(ShellArgs) -> rewrite_leaders(OldUser, NewUser), maybe_reset_logger(LoggerState); true -> - ok = start_interactive() + ok = start_interactive(ShellArgs) end. -start_interactive() -> - shell:start_interactive(). +start_interactive(ShellArgs) -> + apply(shell, start_interactive, ShellArgs). %% @private starting with OTP-21.2.3, there's an oddity where the logger %% likely tries to handle system logs while we take down the TTY, which From 288df1270bd0c433a4b3c5ef4d1ed5b22419f8ff Mon Sep 17 00:00:00 2001 From: Duncan McGreggor Date: Sat, 5 Aug 2023 15:37:57 -0500 Subject: [PATCH 2/6] Tweaked the log message to be a little more accurate. --- apps/rebar/src/rebar_prv_shell.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/rebar/src/rebar_prv_shell.erl b/apps/rebar/src/rebar_prv_shell.erl index c2b09e17e..b2d0cb447 100644 --- a/apps/rebar/src/rebar_prv_shell.erl +++ b/apps/rebar/src/rebar_prv_shell.erl @@ -130,7 +130,7 @@ shell(State) -> setup_name(State), setup_paths(State), ShellArgs = debug_get_value(shell_args, rebar_state:get(State, shell, []), undefined, - "Found user_drv args from command line option."), + "Found shell args from command line option or plugin."), setup_shell(ShellArgs), maybe_run_script(State), %% apps must be started after the change in shell because otherwise From 6d2cd18f5833703f25d6064cdfe082bddfbddce5 Mon Sep 17 00:00:00 2001 From: Duncan McGreggor Date: Wed, 9 Aug 2023 15:34:38 -0500 Subject: [PATCH 3/6] Updated help string for user_drv_args. --- apps/rebar/src/rebar_prv_shell.erl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/rebar/src/rebar_prv_shell.erl b/apps/rebar/src/rebar_prv_shell.erl index b2d0cb447..3b0b184f8 100644 --- a/apps/rebar/src/rebar_prv_shell.erl +++ b/apps/rebar/src/rebar_prv_shell.erl @@ -93,8 +93,12 @@ init(State) -> "Path to file of os environment variables to setup " "before expanding vars in config files."}, {user_drv_args, undefined, "user_drv_args", string, - "Arguments passed to user_drv start function for " - "creating custom shells."}, + "For versions of Erlang prior to 26, this option " + "can be used to pass arguments to the user_drv start " + "function for creating custom shells. Starting " + "with Erlang 26, the arguments defined with this " + "option will instead be applied to the shell " + "start_interactive function."}, {eval, undefined, "eval", string, "Erlang term(s) to execute after the apps have been " "started, but before the shell is presented to the " From 832bef28065707fca37675579ea1f3dbe7de3655 Mon Sep 17 00:00:00 2001 From: Duncan McGreggor Date: Wed, 9 Aug 2023 15:45:10 -0500 Subject: [PATCH 4/6] Improved wording. --- apps/rebar/src/rebar_prv_shell.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/rebar/src/rebar_prv_shell.erl b/apps/rebar/src/rebar_prv_shell.erl index 3b0b184f8..f56aea514 100644 --- a/apps/rebar/src/rebar_prv_shell.erl +++ b/apps/rebar/src/rebar_prv_shell.erl @@ -97,8 +97,8 @@ init(State) -> "can be used to pass arguments to the user_drv start " "function for creating custom shells. Starting " "with Erlang 26, the arguments defined with this " - "option will instead be applied to the shell " - "start_interactive function."}, + "option are applied to the shell start_interactive " + "function."}, {eval, undefined, "eval", string, "Erlang term(s) to execute after the apps have been " "started, but before the shell is presented to the " From a34972f119da4119682abc81153f67e98d0c5cae Mon Sep 17 00:00:00 2001 From: Duncan McGreggor Date: Wed, 9 Aug 2023 15:45:45 -0500 Subject: [PATCH 5/6] Added missing punctuation. --- apps/rebar/src/rebar_prv_shell.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/rebar/src/rebar_prv_shell.erl b/apps/rebar/src/rebar_prv_shell.erl index f56aea514..c3e09e721 100644 --- a/apps/rebar/src/rebar_prv_shell.erl +++ b/apps/rebar/src/rebar_prv_shell.erl @@ -82,10 +82,10 @@ init(State) -> "relx apps if not specified."}, {relname, $r, "relname", atom, "Name of the release to use as a template for the " - "shell session"}, + "shell session."}, {relvsn, $v, "relvsn", string, "Version of the release to use for the shell " - "session"}, + "session."}, {start_clean, undefined, "start-clean", boolean, "Cancel any applications in the 'apps' list " "or release."}, From 72250ddfd4e05b510ed8ef6fa1af9a6c0bfe6d0c Mon Sep 17 00:00:00 2001 From: Duncan McGreggor Date: Wed, 9 Aug 2023 15:47:46 -0500 Subject: [PATCH 6/6] Updated the arity for the dialyzer no-warn. --- apps/rebar/src/rebar_prv_shell.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/rebar/src/rebar_prv_shell.erl b/apps/rebar/src/rebar_prv_shell.erl index c3e09e721..fc0e7ab35 100644 --- a/apps/rebar/src/rebar_prv_shell.erl +++ b/apps/rebar/src/rebar_prv_shell.erl @@ -42,7 +42,7 @@ -define(DEPS, [compile]). -dialyzer({nowarn_function, rewrite_leaders/2}). --dialyzer({nowarn_function, start_interactive/0}). +-dialyzer({nowarn_function, start_interactive/1}). %% =================================================================== %% Public API