Skip to content

Commit

Permalink
Generate error event when deploy target directory is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
eproxus committed Nov 9, 2021
1 parent 750944a commit a917f36
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/grisp_tools_deploy.erl
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,13 @@ copy_release(#{release := Release, copy := Copy} = State0) ->
true -> "cp -Rf";
false -> "cp -R"
end,
State2 = case filelib:is_dir(Dest) of
false -> event(State1, [release, {error, target_dir_missing, Dest}]);
true -> State1
end,
Command = string:join([CopyExe, qoute(Source ++ "/"), qoute(Target)], " "),
{Output, State2} = shell(State1, Command),
event(State2, [release, {copy, {result, Output}}]).
{Output, State3} = shell(State2, Command),
event(State3, [release, {copy, {result, Output}}]).

qoute(String) -> "\"" ++ String ++ "\"".

Expand Down

0 comments on commit a917f36

Please sign in to comment.