diff options
author | Peter Andersson <[email protected]> | 2012-08-10 11:41:38 +0200 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2012-08-10 11:41:38 +0200 |
commit | 4b70df67d825c1b44ca15a5a4ecd57ad1828ead3 (patch) | |
tree | cd31772649b8f1e599e7fbe2cf7b76b1c2dc7a7b /lib/stdlib/src | |
parent | c075ac6484e3d5a93a0d870ab4483d39ae26eaec (diff) | |
parent | f968ff87b1d6fb74237010bffa0390953337425e (diff) | |
download | otp-4b70df67d825c1b44ca15a5a4ecd57ad1828ead3.tar.gz otp-4b70df67d825c1b44ca15a5a4ecd57ad1828ead3.tar.bz2 otp-4b70df67d825c1b44ca15a5a4ecd57ad1828ead3.zip |
Merge remote branch 'upstream/maint' into maint
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r-- | lib/stdlib/src/escript.erl | 18 | ||||
-rw-r--r-- | lib/stdlib/src/gen_server.erl | 2 |
2 files changed, 17 insertions, 3 deletions
diff --git a/lib/stdlib/src/escript.erl b/lib/stdlib/src/escript.erl index 27e70ac4d4..498d850df3 100644 --- a/lib/stdlib/src/escript.erl +++ b/lib/stdlib/src/escript.erl @@ -22,7 +22,7 @@ -export([script_name/0, create/2, extract/2]). %% Internal API. --export([start/0, start/1]). +-export([start/0, start/1, parse_file/1]). %%----------------------------------------------------------------------- @@ -346,7 +346,8 @@ parse_and_run(File, Args, Options) -> case Source of archive -> {ok, FileInfo} = file:read_file_info(File), - case code:set_primary_archive(File, FormsOrBin, FileInfo) of + case code:set_primary_archive(File, FormsOrBin, FileInfo, + fun escript:parse_file/1) of ok when CheckOnly -> case code:load_file(Module) of {module, _} -> @@ -396,6 +397,19 @@ parse_and_run(File, Args, Options) -> %% Parse script %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Only used as callback by erl_prim_loader +parse_file(File) -> + try parse_file(File, false) of + {_Source, _Module, FormsOrBin, _HasRecs, _Mode} + when is_binary(FormsOrBin) -> + {ok, FormsOrBin}; + _ -> + {error, no_archive_bin} + catch + throw:Reason -> + {error, Reason} + end. + parse_file(File, CheckOnly) -> {HeaderSz, NextLineNo, Fd, Sections} = parse_header(File, false), diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl index 59c6d240ba..04308a51b7 100644 --- a/lib/stdlib/src/gen_server.erl +++ b/lib/stdlib/src/gen_server.erl @@ -270,7 +270,7 @@ enter_loop(Mod, Options, State) -> enter_loop(Mod, Options, State, self(), infinity). enter_loop(Mod, Options, State, ServerName = {Scope, _}) - when Scope == local; Scope == local -> + when Scope == local; Scope == global -> enter_loop(Mod, Options, State, ServerName, infinity); enter_loop(Mod, Options, State, ServerName = {via, _, _}) -> |