diff options
author | Hans Nilsson <[email protected]> | 2017-07-07 14:27:24 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2017-07-07 14:27:24 +0200 |
commit | 2a2f73ae782f56bb9ac3b983f77a512b9caafacf (patch) | |
tree | 2f664b4923d6760031c3be0c57f402538fa9ab94 | |
parent | cc4de75dcb833610e52c7422b743c43556064a0a (diff) | |
parent | 6be0ed124af615a3ea17d4f913649b50aef68821 (diff) | |
download | otp-2a2f73ae782f56bb9ac3b983f77a512b9caafacf.tar.gz otp-2a2f73ae782f56bb9ac3b983f77a512b9caafacf.tar.bz2 otp-2a2f73ae782f56bb9ac3b983f77a512b9caafacf.zip |
Merge pull request #1503 from profil/maint
Add support for binary input in ssh_io
OTP-14506
-rw-r--r-- | lib/ssh/src/ssh_io.erl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ssh/src/ssh_io.erl b/lib/ssh/src/ssh_io.erl index 8ba759ad60..a7cd1daeec 100644 --- a/lib/ssh/src/ssh_io.erl +++ b/lib/ssh/src/ssh_io.erl @@ -31,8 +31,8 @@ read_line(Prompt, Opts) -> format("~s", [listify(Prompt)]), ?GET_INTERNAL_OPT(user_pid, Opts) ! {self(), question}, receive - Answer when is_list(Answer) -> - Answer + Answer when is_list(Answer) or is_binary(Answer) -> + unicode:characters_to_list(Answer) end. yes_no(Prompt, Opts) -> @@ -44,7 +44,7 @@ yes_no(Prompt, Opts) -> y -> yes; n -> no; - Answer when is_list(Answer) -> + Answer when is_list(Answer) or is_binary(Answer) -> case trim(Answer) of "y" -> yes; "n" -> no; @@ -60,7 +60,7 @@ read_password(Prompt, Opts) -> format("~s", [listify(Prompt)]), ?GET_INTERNAL_OPT(user_pid, Opts) ! {self(), user_password}, receive - Answer when is_list(Answer) -> + Answer when is_list(Answer) or is_binary(Answer) -> case trim(Answer) of "" -> read_password(Prompt, Opts); |