diff --git a/lib/sshex.ex b/lib/sshex.ex index 24d2d7d..c0d4143 100644 --- a/lib/sshex.ex +++ b/lib/sshex.ex @@ -145,7 +145,9 @@ defmodule SSHEx do end end - after_fun = fn(_)-> :ok end + after_fun = fn(channel) -> + :ok = opts[:connection_module].close(conn, channel) + end Stream.resource start_fun, next_fun, after_fun end diff --git a/test/sshex_test.exs b/test/sshex_test.exs index 927d903..063f574 100644 --- a/test/sshex_test.exs +++ b/test/sshex_test.exs @@ -141,22 +141,26 @@ defmodule AllOKMock do def session_channel(_,_), do: {:ok, :mocked} def exec(_,_,_,_), do: :success def adjust_window(_,_,_), do: :ok + def close(_, _), do: :ok end defmodule ExecFailureMock do def session_channel(_,_), do: {:ok, :mocked} def exec(_,_,_,_), do: :failure def adjust_window(_,_,_), do: :ok + def close(_, _), do: :ok end defmodule ExecErrorMock do def session_channel(_,_), do: {:ok, :mocked} def exec(_,_,_,_), do: {:error, :reason} def adjust_window(_,_,_), do: :ok + def close(_, _), do: :ok end defmodule SessionChannelErrorMock do def session_channel(_,_), do: {:error, :reason} def exec(_,_,_,_), do: :success def adjust_window(_,_,_), do: :ok + def close(_, _), do: :ok end