Last active
June 23, 2025 18:22
-
-
Save binarytemple/9ebc267bf01cab86e8fbc9188e6a10d1 to your computer and use it in GitHub Desktop.
Generate a list of all processes in the system which are neither linked nor monitored.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Diags do | |
@doc """ | |
Generate a list of all processes in the system which are neither linked nor monitored. | |
""" | |
def list_non_linked_non_monitored_processes do | |
Process.list |> | |
Enum.map( fn pid -> {pid, Process.info( pid, [:links,:monitors,:registered_name])} end) |> | |
Enum.map( | |
fn {pid, words} -> {pid, | |
Keyword.get(words,:links), | |
Keyword.get(words,:monitors), | |
Keyword.get(words,:registered_name) | |
} | |
end ) |> | |
Enum.filter(fn | |
{_,[],[],_} -> true | |
_ -> false | |
end) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment