ForestTreeTrain
ForestTreeTrain

Reputation: 3

How to get instance of a specific running process in Elixir?

In elixir, if I invoke spawn to create a process but didn't store the process instance to a variable, how can I retrieve the instance of that PID again?

I know I can use Process.list() which will return all the processes running in the current node but is there a way to retrieve the instance of a specific PID?

Upvotes: 0

Views: 844

Answers (1)

Marcos Tapajós
Marcos Tapajós

Reputation: 564

The easiest way would be set a name for the process and retrieve it using Process.whereis/1.

Upvotes: 1

Related Questions