diff options
author | Hans Bolinder <[email protected]> | 2017-09-26 09:25:43 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2017-10-03 10:32:42 +0200 |
commit | 23817dd3f1bd70ede570b2aa065fe4ff26aedc04 (patch) | |
tree | 081326d7663809f6c51cfd4fc1cd3dd70d25916e | |
parent | 8fb29181bca26c221ca0a3364f71f79d3d3a4db4 (diff) | |
download | otp-23817dd3f1bd70ede570b2aa065fe4ff26aedc04.tar.gz otp-23817dd3f1bd70ede570b2aa065fe4ff26aedc04.tar.bz2 otp-23817dd3f1bd70ede570b2aa065fe4ff26aedc04.zip |
stdlib: Make ets:i/1 exit cleaner upon ^D (old Erlang shell)
Instead of crashing, ^D now exits Erlang if started with -oldshell.
-rw-r--r-- | lib/kernel/src/user.erl | 6 | ||||
-rw-r--r-- | lib/stdlib/src/ets.erl | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/kernel/src/user.erl b/lib/kernel/src/user.erl index a5cc7b0ec1..872e63ab53 100644 --- a/lib/kernel/src/user.erl +++ b/lib/kernel/src/user.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2016. All Rights Reserved. +%% Copyright Ericsson AB 1996-2017. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -398,7 +398,7 @@ get_line(Prompt, Port, Q, Acc, Enc) -> get_line_bytes(Prompt, Port, Q, Acc, Bytes, Enc); {Port, eof} -> put(eof, true), - {ok, eof, []}; + {ok, eof, queue:new()}; {io_request,From,ReplyAs,{get_geometry,_}=Req} when is_pid(From) -> do_io_request(Req, From, ReplyAs, Port, queue:new()), @@ -615,7 +615,7 @@ get_chars(Prompt, M, F, Xa, Port, Q, State, Enc) -> get_chars_bytes(State, M, F, Xa, Port, Q, Bytes, Enc); {Port, eof} -> put(eof, true), - {ok, eof, []}; + {ok, eof, queue:new()}; %%{io_request,From,ReplyAs,Request} when is_pid(From) -> %% get_chars_req(Prompt, M, F, Xa, Port, queue:new(), State, %% Request, From, ReplyAs); diff --git a/lib/stdlib/src/ets.erl b/lib/stdlib/src/ets.erl index b5d3cd3c8d..1db004c91e 100644 --- a/lib/stdlib/src/ets.erl +++ b/lib/stdlib/src/ets.erl @@ -1700,6 +1700,8 @@ choice(Height, Width, P, Mode, Tab, Key, Turn, Opos) -> io:format("~ts\n", [ErrorString]), choice(Height, Width, P, Mode, Tab, Key, Turn, Opos) end; + eof -> + ok; _ -> choice(Height, Width, P, Mode, Tab, Key, Turn, Opos) end. |