From 2cd39378442f3dc727de22289243b3c4d56f25fd Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Fri, 9 Feb 2018 08:47:44 -0800 Subject: [PATCH] Enable code coverage and fix port location logic --- rebar.config | 1 + src/canola.erl | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index da4c6ec..c5a439b 100644 --- a/rebar.config +++ b/rebar.config @@ -1,6 +1,7 @@ {port_specs, [{"priv/canola-port", ["c_src/canola-port.c"]}]}. {port_env, [{"LDFLAGS", "$LDFLAGS -lpam"}]}. +{cover_enabled, true}. {plugins, [pc]}. diff --git a/src/canola.erl b/src/canola.erl index f92f326..15b60ee 100644 --- a/src/canola.erl +++ b/src/canola.erl @@ -51,5 +51,15 @@ open2(Debug) -> _ -> [] end, - Dir = filename:dirname(code:which(?MODULE)), - open_port({spawn_executable, Dir++"/../priv/canola-port"}, [{args, Args}, {packet, 4}, exit_status]). + PortBin = case code:priv_dir(ebloom) of + {error, bad_name} -> + case code:which(?MODULE) of + Filename when is_list(Filename) -> + filename:join([filename:dirname(Filename),"../priv", "canola-port"]); + _ -> + filename:join("priv", "canola-port") + end; + Dir -> + filename:join(Dir, "canpola-port") + end, + open_port({spawn_executable, PortBin}, [{args, Args}, {packet, 4}, exit_status]). -- 2.45.2