Skip to content

Commit

Permalink
Properly unlink port after use in example
Browse files Browse the repository at this point in the history
Closes #41.
  • Loading branch information
josevalim authored Feb 26, 2024
1 parent 792fbd2 commit 17a36c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ defmodule PortPool do
pool_timeout = Keyword.get(opts, :pool_timeout, 5000)
receive_timeout = Keyword.get(opts, :receive_timeout, 15000)

NimblePool.checkout!(pool, :checkout, fn {pid, _}, port ->
NimblePool.checkout!(pool, :checkout, fn _from, port ->
send(port, {self(), {:command, command}})

receive do
{^port, {:data, data}} ->
try do
Port.connect(port, pid)
Port.unlink(port)
{data, :ok}
rescue
_ -> {data, :close}
Expand Down

0 comments on commit 17a36c9

Please sign in to comment.