aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-02-20 12:33:07 +0100
committerHans Nilsson <[email protected]>2017-02-20 12:33:07 +0100
commit8beb8c6c11bec528d00125634bdebe38cc1b8d26 (patch)
treec38e6ba4c603e43f4fa44a9afba14e110f422eaa /lib
parent24ce55b30fdf4debb914b4f9e228ca70d7a593c2 (diff)
parent8f0cfd160505e5ac6c100db7d1294c2e63dc0cbb (diff)
downloadotp-8beb8c6c11bec528d00125634bdebe38cc1b8d26.tar.gz
otp-8beb8c6c11bec528d00125634bdebe38cc1b8d26.tar.bz2
otp-8beb8c6c11bec528d00125634bdebe38cc1b8d26.zip
Merge branch 'maint'
Diffstat (limited to 'lib')
-rw-r--r--lib/ssh/src/ssh_cli.erl18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/ssh/src/ssh_cli.erl b/lib/ssh/src/ssh_cli.erl
index 8af0ecc5f9..6f8c050486 100644
--- a/lib/ssh/src/ssh_cli.erl
+++ b/lib/ssh/src/ssh_cli.erl
@@ -453,14 +453,20 @@ move_cursor(From, To, #ssh_pty{width=Width, term=Type}) ->
%% %%% make sure that there is data to send
%% %%% before calling ssh_connection:send
write_chars(ConnectionHandler, ChannelId, Chars) ->
- case erlang:iolist_size(Chars) of
- 0 ->
- ok;
- _ ->
- ssh_connection:send(ConnectionHandler, ChannelId,
- ?SSH_EXTENDED_DATA_DEFAULT, Chars)
+ case has_chars(Chars) of
+ false -> ok;
+ true -> ssh_connection:send(ConnectionHandler,
+ ChannelId,
+ ?SSH_EXTENDED_DATA_DEFAULT,
+ Chars)
end.
+has_chars([C|_]) when is_integer(C) -> true;
+has_chars([H|T]) when is_list(H) ; is_binary(H) -> has_chars(H) orelse has_chars(T);
+has_chars(<<_:8,_/binary>>) -> true;
+has_chars(_) -> false.
+
+
%%% tail, works with empty lists
tl1([_|A]) -> A;
tl1(_) -> [].