-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom rebar3 shells cannot pass args when using Erlang 26 #2817
Comments
As for docs, it looks like I would need to update these:
|
Yeah looking at it, and since the default The only risk with the If the latter risk seems acceptable to you (the target audience for this option set) then I think we're good with the proposed implementation. |
Nice -- Thanks! I'll update the docs and take the PR out of draft. |
Btw, the GH Actions CI/CD that need to run for this PR, only the most recent should be run -- that's the one that has the update for the dialyzer ignore (arity change). |
Yep, sorry. I've just manually allowed the run, always manual mode until a contrib is merged apparently. |
I merged it, but I'm just noticing now that I'm looking at the doc PR that we fetch the config from Oh I guess one is the CLI option and one is the state option? |
That is my understanding, yes. (this trips me up every couple of years when I dive into this part of the code ...) |
Pre-Check
@ferd and I have been discussing this for a few days in a Slack thread:
Environment
Current behaviour
With Erlang 26, rebar3 uses
erlang:function_exported(shell, start_interactive, 0)
to determine whether to execute the old work-around for the user_drv startup issues (ownership, etc.). The Erlang 26 code path skips the user_drv setup and instead calls the newshell:start_interactive
function. However, rebar3_prv_shell only uses the arity-0 form of this function and thus any args for custom shells are do not get passed. As such, the LFE rebar3 plugin cannot run the LFE REPL as a custom shell in Erlang 26. Instead, they get the default with no args: the Erlang shell.For Erlang 25 and earlier, example custom shell plugin support is utilised with something the following:
Expected behaviour
Users of the rebar3_lfe plugin should be able to execute
rebar3 lfe repl
and have the LFE REPL start up. As a plugin developer, I should be able write a plugin that lets users start a custom shell with something like the following:When
rebar_prv_shell:setup_shell
detects the interactive shell for Erlang 26, it should callrebar_prv_shell:start_interactive
but it should also passShellArgs
if those have been defined.Contributing
I am more than happy to contribute a small patch to fix this issue. I've hacked a couple different workarounds in rebar3_lfe, with the most recent being the cleanest (thanks entirely to pointers from @rvirding).
I do have a stylistic preference question for you, though:
apply(shell, start_interactive, ShellArgs)
(thus taking advantage of the multiple arities defined for that Erlang 26 function). Is this okay?shell:start_interactive
?In lieu of guidance on team preference, I can start with the former, since that's the least code; if there are objections, I can easily switch to the latter.
Lastly, I'd like to update the docs to make things a little more clear for plugin developers writing custom shells, explaining the allowed/expected args, and why. Not sure where to look for that, yet -- any time-saving pointers are deeply appreciated!
Tasks:
rebar_prv_shell
The text was updated successfully, but these errors were encountered: