- defp receive_and_parse_response(conn, chn, connection_module, tout,
- stdout \\ "", stderr \\ "", status \\ nil, closed \\ false) do
- response = receive do
- {:ssh_cm, ^conn, res} -> res
- after
- tout -> {:error, "Timeout. Did not receive data for #{tout}ms."}
- end
- # call adjust_window to allow more data income, but only when needed
- case response do
- {:data, ^chn, _, new_data} -> connection_module.adjust_window(conn, chn, byte_size(new_data))
- _ -> :ok
- end
- case response do
- {:data, ^chn, 1, new_data} -> {:loop, {chn, tout, stdout, stderr <> new_data, status, closed}}
- {:data, ^chn, 0, new_data} -> {:loop, {chn, tout, stdout <> new_data, stderr, status, closed}}
- {:eof, ^chn} -> {:loop, {chn, tout, stdout, stderr, status, closed}}
- {:exit_signal, ^chn, _, _} -> {:loop, {chn, tout, stdout, stderr, status, closed}}
- {:exit_signal, ^chn, _, _, _} -> {:loop, {chn, tout, stdout, stderr, status, closed}}
This file has been truncated. show original