rebar3 icon indicating copy to clipboard operation
rebar3 copied to clipboard

Escript creation failure reason swallowed by post-hook failure.

Open richcarl opened this issue 1 year ago • 1 comments

https://github.com/erlang/rebar3/blob/a16f41aef7f004394f761f1dae108231ca0ec76e/apps/rebar/src/rebar_prv_escriptize.erl#L99

This catch was introduced in https://github.com/erlang/rebar3/pull/2532 but there is still a problem: if the escript creation fails and the exception is caught, the call to rebar_hooks:run_all_hooks() below will be executed and will likely fail in itself since there will be no _build/prod/bin/rebar3 to copy. This will cause the first exception to be forgotten, and you simply get _build/prod/bin/rebar3: No such file or directory and Hook for escriptize failed! without a clue as to why. (The actual error was {bad_app, App} just as added in #2532.)

Not sure what solution you would prefer, but skipping the post-hooks if creation fails seems reasonable to me.

richcarl avatar Oct 19 '23 19:10 richcarl

I think this may be a duplicate of https://github.com/erlang/rebar3/issues/2798

ferd avatar Oct 20 '23 15:10 ferd