-
-
Save stevedomin/0e92d75997d30b21f931 to your computer and use it in GitHub Desktop.
Process.info/2 weirdness
This file contains 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
iex(1)> pid = spawn fn -> end | |
#PID<0.61.0> | |
iex(2)> Process.info(pid, :status) | |
nil | |
iex(3)> Process.info(pid, :status) | |
nil | |
iex(4)> |
This file contains 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
pid = spawn fn -> end | |
IO.inspect Process.info(pid, :status) # {:status, :runnable} | |
IO.inspect Process.info(pid, :status) # nil |
This file contains 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
test "info/2" do | |
pid = spawn fn -> end | |
assert Process.info(pid, :status) == {:status, :runnable} | |
assert Process.info(pid, [:status]) == [status: :runnable] | |
Process.exit(pid, :kill) | |
assert Process.info(pid, :backtrace) == nil | |
assert Process.info(pid, [:backtrace, :status]) == nil | |
end | |
# specs are passing |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment