Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

SSHEx.stream: #8

Merged
merged 1 commit into from
Oct 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/sshex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/sshex_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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