I noticed that despite the implementation, the Mix task does not appear to return a non-zero exit status when dangers are found. Here's an example:
» mix excellent_migrations.check_safety; echo $status
09:08:12.638 [warning] Index not concurrently in priv/repo/migrations/20230103220859_testing-stuff.exs:5
0
Note: Echo'd status is 0.
Solution
I'm not certain why this is an issue, but I'm guessing that perhaps System.stop(1) isn't behaving as expected with Mix? Perhaps there's another way to return non-zero status from Mix, such as raising an error after logging dangers, https://hexdocs.pm/mix/Mix.html#raise/2.
Problem
I noticed that despite the implementation, the Mix task does not appear to return a non-zero exit status when dangers are found. Here's an example:
Note: Echo'd status is
0
.Solution
I'm not certain why this is an issue, but I'm guessing that perhaps
System.stop(1)
isn't behaving as expected with Mix? Perhaps there's another way to return non-zero status from Mix, such as raising an error after logging dangers, https://hexdocs.pm/mix/Mix.html#raise/2.