[erlang-questions] Why Erlang spawns sub-processes in their own process session / group?

Lukas Larsson lukas@REDACTED
Fri Nov 6 17:00:02 CET 2015

On Tue, Oct 27, 2015 at 7:19 PM, Ciprian Dorin Craciun <
ciprian.craciun@REDACTED> wrote:

> I wonder why such a decision to put newly spawned processes in new
> sessions / groups than the parent Erlang VM?  What is the advantage?

The original decision was made a long time ago (at least before R7B, which
is as far back as I can check) and I think it may have something to do with
the way terminals work. I found this blog post talking about the issue:
https://blog.nelhage.com/2011/02/changing-ctty/. If you want an alternative
that is more flexible you can use https://github.com/saleyn/erlexec, it
appears to take care of this case by allowing you to pass an option
specifying if the child has a terminal or not.

Regardless, all programs that are started with open_port({spawn}) should
anyway listen for a closed stdin/stdout fd in order to determine if the
port that handles it has terminated, so if you take care of that case then
the case of the emulator terminating takes care of itself.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151106/08bec6c2/attachment.htm>

More information about the erlang-questions mailing list