aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2016-08-16 10:17:50 +0200
committerLukas Larsson <[email protected]>2016-08-16 10:17:55 +0200
commitcad08127834757a48ad85b8f6e177c2d1a7f8589 (patch)
tree50af2617032b4e52b2c58c46a5c240d7ab1acd8b /lib/kernel/src
parent020d38d4c9062f255b52eeb35542152c7cff1598 (diff)
downloadotp-cad08127834757a48ad85b8f6e177c2d1a7f8589.tar.gz
otp-cad08127834757a48ad85b8f6e177c2d1a7f8589.tar.bz2
otp-cad08127834757a48ad85b8f6e177c2d1a7f8589.zip
erts: Make sure to flush potential exit message
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/os.erl16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl
index 81b70a7fee..05bbf1069e 100644
--- a/lib/kernel/src/os.erl
+++ b/lib/kernel/src/os.erl
@@ -279,15 +279,11 @@ get_data(Port, MonRef, Eot, Sofar) ->
Last ->
Port ! {self(), close},
flush_until_closed(Port),
+ flush_exit(Port),
iolist_to_binary([Sofar, Last])
end;
{'DOWN', MonRef, _, _ , _} ->
- receive
- {'EXIT', Port, _} ->
- ok
- after 1 -> % force context switch
- ok
- end,
+ flush_exit(Port),
iolist_to_binary(Sofar)
end.
@@ -307,3 +303,11 @@ flush_until_closed(Port) ->
{Port, closed} ->
true
end.
+
+flush_exit(Port) ->
+ receive
+ {'EXIT', Port, _} ->
+ ok
+ after 1 -> % force context switch
+ ok
+ end.