[erlang-questions] Progress bar in Erlang
Thu Sep 7 07:14:16 CEST 2017
On 2017年09月07日 木曜日 04:47:48 Frank Muller wrote:
> Hi guys,
> I’m looking for a simple progress bar module for Erlang?
> Found this one, but it’s in Elixir:
The only one I've seen is for Wx GUIs, not text progress bars like the one you linked.
I'll probably wind up writing one of these eventually to compliment some text layout tools I've accumulated (which I have not yet extracted out of a few projects into a separate text env library).
As a side note...
If you decide to write this or translate it to Erlang yourself, keep in mind that writing an output lib in a highly concurrent environment requires (usually) multiplexing output requests from concurrent processes. This is overlooked in many projects so when unexpected things happen (even benign things) the screen turns into a portal of chaos.
Abstract the text output device as a process so you can communicate with the "screen" within Erlang via messages and get sequential resource access in a sane way. That way the timing of concurrent output doesn't jam things up. Also, there is the detail of figuring out which sort of terminal you're talking to (Windows just doesn't do anything the way you'd ever expect), which is simple if you just assume its always a unixy terminal but is surprisingly difficult to sort out if you want to develop a complete-ish cross-platform solution (which is why I tend to stick with single-line text output OR leap way over that and go to a GUI environment with Wx).
More information about the erlang-questions