aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-04-12 07:14:57 +0200
committerBjörn Gustavsson <[email protected]>2016-05-04 10:21:14 +0200
commitf77ea1c049c585db93618991eb02d9afbfa7ad21 (patch)
tree9abe7fa4b502dbc1ed70082df463b5badda6a5b7 /lib/kernel/src
parent4050fc5665a4819b15f204543c28c59726b4aac9 (diff)
downloadotp-f77ea1c049c585db93618991eb02d9afbfa7ad21.tar.gz
otp-f77ea1c049c585db93618991eb02d9afbfa7ad21.tar.bz2
otp-f77ea1c049c585db93618991eb02d9afbfa7ad21.zip
Reimplement -on_load()
Load the module as old code; swap old and new code if the -on_load function succeeds. That way, a failed update attempt for a module that has an -on_load function will preserve the previous version of the code.
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/code_server.erl1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/kernel/src/code_server.erl b/lib/kernel/src/code_server.erl
index 90b2a06c46..56372f90ca 100644
--- a/lib/kernel/src/code_server.erl
+++ b/lib/kernel/src/code_server.erl
@@ -1351,6 +1351,7 @@ finish_on_load_1(Mod, File, OnLoadRes, WaitingPids, Db) ->
Res = case Keep of
false ->
_ = finish_on_load_report(Mod, OnLoadRes),
+ _ = erts_code_purger:purge(Mod),
{error,on_load_failure};
true ->
ets:insert(Db, {Mod,File}),