diff options
author | Erlang/OTP <[email protected]> | 2016-08-16 10:25:25 +0200 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2016-08-16 10:25:25 +0200 |
commit | 4e5a23e78f693e1c2c9ddfffd24675c22db73a3f (patch) | |
tree | 073cbbe888ec9e3f6ad0dd704c4d1bd4c4122155 /lib/kernel/src/os.erl | |
parent | 19db7510939149206017c925032d390da9a83fe9 (diff) | |
parent | cad08127834757a48ad85b8f6e177c2d1a7f8589 (diff) | |
download | otp-4e5a23e78f693e1c2c9ddfffd24675c22db73a3f.tar.gz otp-4e5a23e78f693e1c2c9ddfffd24675c22db73a3f.tar.bz2 otp-4e5a23e78f693e1c2c9ddfffd24675c22db73a3f.zip |
Merge branch 'lukas/kernel/os_cmd_fix_exit_message_leak/OTP-13813' into maint-19
* lukas/kernel/os_cmd_fix_exit_message_leak/OTP-13813:
erts: Make sure to flush potential exit message
Diffstat (limited to 'lib/kernel/src/os.erl')
-rw-r--r-- | lib/kernel/src/os.erl | 16 |
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. |