Skip to content

Commit

Permalink
Enable code coverage and fix port location logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Vagabond committed Feb 9, 2018
1 parent 246e63f commit 2cd3937
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{port_specs, [{"priv/canola-port", ["c_src/canola-port.c"]}]}.

{port_env, [{"LDFLAGS", "$LDFLAGS -lpam"}]}.
{cover_enabled, true}.

{plugins, [pc]}.

Expand Down
14 changes: 12 additions & 2 deletions src/canola.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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]).

0 comments on commit 2cd3937

Please sign in to comment.