The Erlang Shell

Would you mind expanding on what you mean here with an example?

Thanks for all the other suggestions, I think we should be able to do most of them although tab-completion for filenames may be a bit tricky…

2 Likes

I use Ctrl+A or Ctrl+E to break out of search as using Ctrl+D while searching in bash will exit the shell…

Great idea, added to the list of things to look at!

2 Likes

We are trying to bring the Windows and Unix shell experience closer together and from what I can tell there is no readline for Windows (though I have only done some cursory checking, so I may be wrong). It seems like ruby/pry have gotten around that by building a pure ruby version of readline, which is kind of what the internal shell implementation of Erlang does today.

Maybe there is someway to use readline if it is available so that you can get all of the goodies, but still have a relatively similar shell for Windows…

2 Likes

I had no idea about this! This is great!

4 Likes

There is a chapter hidden away in the Erts User’s Guide with some of the keybindings available in the shell. Ctrl+] is the in there, but also a few others that I did not know about.

10 Likes

This is awesome! Would it be possible include some standard Mac commands using the command key? Such as CMD+< for beginning of line and CMD+> for end of line? For many Mac users these are hard-wired into our brains :lol:

Edit: Just realised in Terminal App those shortcuts jump between windows… however option and the arrow keys jump to the beginning/end of line :023:

3 Likes

I mean that a kernel (?) config should be existing to jail any disk access for functions into a root directory .
This way only system could open config elsewhere before shell start.
This to avoid any rogue attempt to modify config or read some keys or private data.
I add this should also apply to function call via rpc.

2 Likes

You don’t just hit Home/End keys?!

1 Like

We don’t have those on the smaller Apple keyboards :lol:

2 Likes

That is horrifying, lol. Even my crappy old dell laptop at work has those. ^.^;

Home/End is used for so much! How do you replicate the action of Ctrl+Home/End, or Shift+Home/End, or Ctrl+Shift+Home/End, or Alt+Home/End, or all the other combinations that I use on an hourly basis?!?

4 Likes

Would multiline editing allow us to type a full module, as Elixir allows us?

2 Likes

No, that would require more substantial changes to the shell parser, including the ability to call into the compiler then.

2 Likes

As @OvermindDL1 said, it will require different changes to what multi line editing entails. However, we will be looking at allowing modules to be defined in the shell. Not sure yet if it can be done in a satisfactory way.

5 Likes

A kind of ‘chroot’, defining path configured in this config as new rootdir “/” for all disk functions calls, after kernel start.

3 Likes

PowerShell 7.2 has PSReadLine bundled.

3 Likes

I’d like to see better support for running the shell via the Erlang ssh application in its daemon mode. Both in the way of making the ssh application easier to configure (not relying on keys in files on local disk, for example), and in making more shell functionality work well (today the shell break mode isn’t there at all, for example).

Direct Erlang shell access via ssh with a user experience that’s on par with that of running erl from a local shell would remove much of the need for developers to have shell access to servers, at least for us.

5 Likes

I was checking on psreadline, and while it claims to be inspired by gnu readline it (to me) seems to be a very different tool. More of an adaption/extension of ps than a way for programs implement their own shells.

I’ll dig a bit more, but it does not seem like we can use it to build a good shell for Erlang.

2 Likes

That doesn’t have anything to do with the shell though and I would say it can be better solved by os level tools.

3 Likes

No, i think you didn’t understood the need.
I’m not talking of an OS chroot that can come too. I’m talking about jailing users using shell once connected to avoid any attempt to change config. Restricted shell exists in Erlang but this would require to customize all erlang function accessing to disk. I’m even not sure i know all of them. We need to separate disk access between node itself and shell. No security will ever happen in Erlang without this.

2 Likes

I’ve wanted to fix #4337. Having difficulty finding time. Will try to revisit if OTP team can’t.

3 Likes