diff options
author | Hans Nilsson <[email protected]> | 2017-02-20 12:32:29 +0100 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2017-02-20 12:32:29 +0100 |
commit | 8f0cfd160505e5ac6c100db7d1294c2e63dc0cbb (patch) | |
tree | 3a84fc5b2eecb54d813681b1cfa671382297a36c /lib | |
parent | 5d8a3ae82e6c6cac43b02e2fee238446167db14a (diff) | |
parent | de437e3639912a0570541fa10c473ac0f0372806 (diff) | |
download | otp-8f0cfd160505e5ac6c100db7d1294c2e63dc0cbb.tar.gz otp-8f0cfd160505e5ac6c100db7d1294c2e63dc0cbb.tar.bz2 otp-8f0cfd160505e5ac6c100db7d1294c2e63dc0cbb.zip |
Merge branch 'hans/ssh/iolist_on_unicode/ERL-364/OTP-14230' into maint
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ssh/src/ssh_cli.erl | 18 |
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(_) -> []. |