aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-06-17 16:01:38 +0200
committerHans Nilsson <[email protected]>2016-06-27 13:48:45 +0200
commit12cdbfec9d19378057e92200564198f359ea3c43 (patch)
tree9708a624d7823e7d2483816e3da13f077f7e03c2 /lib
parent4586fd6fa3447a1c4191620fe5b8f4412d5af0ad (diff)
downloadotp-12cdbfec9d19378057e92200564198f359ea3c43.tar.gz
otp-12cdbfec9d19378057e92200564198f359ea3c43.tar.bz2
otp-12cdbfec9d19378057e92200564198f359ea3c43.zip
ssh: polishing of password prompt's linefeed
Diffstat (limited to 'lib')
-rw-r--r--lib/ssh/src/ssh_auth.erl13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/ssh/src/ssh_auth.erl b/lib/ssh/src/ssh_auth.erl
index c8f66c9d61..fb5e086656 100644
--- a/lib/ssh/src/ssh_auth.erl
+++ b/lib/ssh/src/ssh_auth.erl
@@ -528,17 +528,18 @@ keyboard_interact_get_responses(true, Fun, _Pwd, _IoCb, Name, Instr, PromptInfos
keyboard_interact_fun(Fun, Name, Instr, PromptInfos, NumPrompts).
keyboard_interact(IoCb, Name, Instr, Prompts, Opts) ->
- if Name /= "" -> IoCb:format("~s~n", [Name]);
- true -> ok
- end,
- if Instr /= "" -> IoCb:format("~s~n", [Instr]);
- true -> ok
- end,
+ write_if_nonempty(IoCb, Name),
+ write_if_nonempty(IoCb, Instr),
lists:map(fun({Prompt, true}) -> IoCb:read_line(Prompt, Opts);
({Prompt, false}) -> IoCb:read_password(Prompt, Opts)
end,
Prompts).
+write_if_nonempty(_, "") -> ok;
+write_if_nonempty(_, <<>>) -> ok;
+write_if_nonempty(IoCb, Text) -> IoCb:format("~s~n",[Text]).
+
+
keyboard_interact_fun(KbdInteractFun, Name, Instr, PromptInfos, NumPrompts) ->
Prompts = lists:map(fun({Prompt, _Echo}) -> Prompt end,
PromptInfos),