nat-n / poethepoet

A task runner that works well with poetry.
https://poethepoet.natn.io/
MIT License
1.46k stars 59 forks source link

Question/proposal: ignore_fail=true and final exit status of the task sequence #39

Closed tsimoshka closed 3 years ago

tsimoshka commented 3 years ago

Hi,

Maybe I'm missing something, but it looks like a task sequence with ingore_fail = true will run all the tasks and in the end will report zero-exit status even if one of the tasks ended with non-zero exit status. Which is logical considering the name of the option.

But I think that it'll be really nice to have a similar option (or to change the logic behind the ignore_fail option) to report non-zero exit status when any of the tasks in sequence finished with the error. 

I can draft a pull-request if you think this is a good idea.

nat-n commented 3 years ago

Hi @tsimoshka, I see how that could be useful. I'd be hesitant to add another option as a variation on an existing one, but we could make this one also accept other values as a non-breaking change.

Maybe something like:

ingore_fail = "return_non_zero" # makes it return

or

ingore_fail = "return_zero" # equivalent to true

This would require adding a validation condition that enforces that if it's a string then it's one of the known values.

I'm focused on other features for the moment, so if you create a PR (including updates to docs and test) then that would certainly help make this a reality sooner.

What do you think?

tsimoshka commented 3 years ago

Seems reasonable. I think I'll submit a PR in a day or two.

tsimoshka commented 3 years ago

@nat-n, PR is ready, take a look when you have time.

I had to update type annotations for the __options__ in base task and all subclasses to keep mypy happy and be able to parse bool and str ignore_fail option. Not sure if this is a right approach.

nat-n commented 3 years ago

Yes the approach is good.

And here's a pre-release for your efforts! https://pypi.org/project/poethepoet/0.11.0b6/