diff options
author | Zandra Hird <[email protected]> | 2015-03-10 10:53:58 +0100 |
---|---|---|
committer | Zandra Hird <[email protected]> | 2015-03-10 10:53:58 +0100 |
commit | f0f727d1d22282786048d8024e60bb2f24e7202e (patch) | |
tree | d20f7aa42b55e924fd089eabe5ad848e6db6ce9c /lib/stdlib/src | |
parent | 69c8c443fa54de2d82f8e91d668b529c718a71d7 (diff) | |
parent | 6d680342efe0f66cd0f975373be65af8fd3703a1 (diff) | |
download | otp-f0f727d1d22282786048d8024e60bb2f24e7202e.tar.gz otp-f0f727d1d22282786048d8024e60bb2f24e7202e.tar.bz2 otp-f0f727d1d22282786048d8024e60bb2f24e7202e.zip |
Merge branch 'josevalim/jv-binary-ets' into maint
* josevalim/jv-binary-ets:
Support binary standard input in ets:i/1
OTP-12550
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/ets.erl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/stdlib/src/ets.erl b/lib/stdlib/src/ets.erl index 42b11a97e2..93c4f59896 100644 --- a/lib/stdlib/src/ets.erl +++ b/lib/stdlib/src/ets.erl @@ -1613,13 +1613,18 @@ choice(Height, Width, P, Mode, Tab, Key, Turn, Opos) -> end. get_line(P, Default) -> - case io:get_line(P) of + case line_string(io:get_line(P)) of "\n" -> Default; L -> L end. +%% If the standard input is set to binary mode +%% convert it to a list so we can properly match. +line_string(Binary) when is_binary(Binary) -> unicode:characters_to_list(Binary); +line_string(Other) -> Other. + nonl(S) -> string:strip(S, right, $\n). print_number(Tab, Key, Num) -> |