refactor: use System.stop/1
to enable caller to rescue tasks
#35
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📖 Description and reason
Hello 👋 ,
First of all, thank you for
mix_audit
and your work.I am currently working on a small package that just does a bunch of different checks on elixir repositories. One of these check is a scan of the repository's dependencies, and I am using
mix_audit
for that.So I have a Mix task calling another one:
mix deps.audit
; it's just a tiny wrapper over it.However, the way I am calling it, through a small
.exs
script, makes it so I can't really call it usingSystem.cmd/3
(for remote reasons, but basically, it doesn't find the task that way because of the way I installmix_audit
and the execution context of the script). Considering that you are usingSystem.halt/1
, it's the only way for me to prevent the process calling thedeps.audit
task from shutting down the other processes from my "meta" task.A simple change that makes my life incredibly easier is using
System.stop/1
instead. That let's me call thedeps.audit
task throughMix.Task.run/2
, and handle it that way.I don't see any downside to this change as it does not change the current behaviour, but you might have had a good reason to use
System.halt/1
in the first place.If that's the case, I'd love to hear about it.
👷 Work done
Tasks
System.halt/1
calls toSystem.stop/1
calls🎉 Result
This change has no functional impact whatsoever
🦀 Dispatch
#dispatch/elixir