aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/src/cover.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-06-15 11:52:33 +0200
committerBjörn Gustavsson <[email protected]>2015-06-15 11:52:33 +0200
commit22c10c0405f14ae33da731129b049724484fa413 (patch)
treee0975104ec602c55c48fc338371bf87daea1c335 /lib/tools/src/cover.erl
parent8ce0fd7fb870ee2bd02d97c77e009d409266573e (diff)
parentb1012c31f38810c6754dcd4cf03f8d2bfb010506 (diff)
downloadotp-22c10c0405f14ae33da731129b049724484fa413.tar.gz
otp-22c10c0405f14ae33da731129b049724484fa413.tar.bz2
otp-22c10c0405f14ae33da731129b049724484fa413.zip
Merge branch 'gomoripeti/tools/cover-no-beam/OTP-12806'
* gomoripeti/tools/cover-no-beam/OTP-12806: cover: handle undefined module when analysing to file
Diffstat (limited to 'lib/tools/src/cover.erl')
-rw-r--r--lib/tools/src/cover.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/tools/src/cover.erl b/lib/tools/src/cover.erl
index 3cffa093dc..9ec5e809bc 100644
--- a/lib/tools/src/cover.erl
+++ b/lib/tools/src/cover.erl
@@ -782,7 +782,7 @@ main_process_loop(State) ->
{From, {{analyse_to_file, Opts},Module}} ->
S = try
Loaded = is_loaded(Module, State),
- spawn(fun() ->
+ spawn_link(fun() ->
?SPAWN_DBG(analyse_to_file,{Module,Opts}),
do_parallel_analysis_to_file(
Module, Opts, Loaded, From, State)
@@ -2153,7 +2153,13 @@ find_source(Module, File0) ->
throw_file(filename:join([BeamDir, "..", "src", Base])),
%% Not in ../src: look for source path in compile info, but
%% first look relative the beam directory.
- Info = lists:keyfind(source, 1, Module:module_info(compile)),
+ Info =
+ try lists:keyfind(source, 1, Module:module_info(compile))
+ catch error:undef ->
+ %% The module might have been imported
+ %% and the beam not available
+ throw({beam, File0})
+ end,
false == Info andalso throw({beam, File0}), %% stripped
{source, SrcFile} = Info,
throw_file(splice(BeamDir, SrcFile)), %% below ../src