The Erlang Shell

This was what put me up to it, yes…

… and no, I wouldn’t.

But it doesn’t make a difference what my intention was IMO, a crashed node is a crashed node. And while there are things that are obviously stupid and/or dangerous when done on a live system, that is not always the case. There are dangerous things that look innocent enough on the outside, and you only learn about it afterwards.

4 Likes

In production, it’s worth enabling +hmakx true with appropriate limits set (not just for the shell, but in general). In OTP 26 RC there are plenty of fixes making it a lot more powerful (like Support including off-heap binaries in max_heap_size by sverker · Pull Request #6345 · erlang/otp · GitHub)

5 Likes

Very cool work in progress here!

Just some thoughts here: perhaps it would be possible in some way to extend the shell with custom functionality?

I’m not sure how that would work but as an example, for edbg I create my own simple shells by making use of io:get_line/2. It works ok, but it is a bit clunky (calling erl_eval, etc) if I want to evaluate an Erlang expression. So it would be nice if I could make use of the existing shell functionality for this.

On the other hand, perhaps you should build in support for tracing/debugging straight into the shell… :slight_smile:

1 Like

This is all very cool. I have one very specific request: I’m looking for a way to capture a transcript of the Erlang console input and output. My use case is for recording use of the remote console on a production system, but it would be useful for recording transcripts/demos of local sessions as well.

I spent a bunch of time looking in the OTP-25.x sources, and didn’t see a clean way to do it.

Thoughts?

2 Likes

Do you know https://asciinema.org/?
If you just want to document certain use cases,
this tool is quite nice. And the recordings are easily embeddable.

3 Likes

Also there’s script. I think it’s already installed in most distros. https://www.redhat.com/sysadmin/record-terminal-script-scriptreplay

2 Likes

having support for set erl start time is good idea for debug, as RunAsDate and faketime.

1 Like

I should have clarified. It’s for compliance (who did what to production?), so it can’t be opt-in, and opting out should be at least slightly tricky.

1 Like

you can have a look, for the game server, right?:smile:
I think that maybe it can be solved by docker

1 Like

@rlipscombe you might consider use of restricted shell, not only for restrict some function, but also to record any of them.

2 Likes

Not exactly a shell directly but thought this would be of interest

2 Likes

Great work on this! Excited to see it all land.

I’m wondering if someone could share the new incantation for “raw mode” input handling. Previously, you’d do use tty_sl. In Elixir:

Port.open({:spawn, "tty_sl -c -e"}, [:binary, :eof])

Thanks in advance to anyone who can enlighten me.

1 Like

Check out the IEx.CLI module in Elixir main branch (on my phone, so no links, sorry). :slight_smile:

2 Likes

Edit: elixir/cli.ex at f3d688229debdbf276ed898e4562a45c4448b29c · elixir-lang/elixir · GitHub

1 Like

Thanks José! I’ll admit that I’ve poured over the IEx source but haven’t yet been able to create a minimal example – basically just the ability to issue get_chars and not have to wait for a newline. I’ll keep cracking at it and will post here if I figure it out.

1 Like