He there! π
Not sure this is a bug or a feature request or expected but...I have the following dodo.py
DOIT_CONFIG = {
"minversion": "0.32.0",
}
import subprocess
from subprocess import Popen, PIPE, STDOUT
import doit
def clean_with_non_zero(task):
cmd = ["ls", "foo"]
try:
subprocess.run(cmd, shell=False, check=True, universal_newlines=True)
return True
except subprocess.CalledProcessError as e:
return doit.exceptions.TaskFailed(e)
def task_fail():
"""Test a doit bug."""
return {
"actions": [clean_with_non_zero],
"clean": [clean_with_non_zero],
"verbosity": 2
}
Please include a minimal dodo.py
that reproduces the problem.
If relevant also include the command line used to invoke doit
.
When I run this I correctly see the exit code:
$ doit fail
. fail
ls: cannot access 'foo': No such file or directory
TaskFailed - taskid:fail
Command '['ls', 'foo']' returned non-zero exit status 2.
$ echo $?
1
But in the following, I instead see a 0
:
$ doit clean fail
fail - executing 'Python: function clean_with_non_zero'
ls: cannot access 'foo': No such file or directory
TaskFailed
Command '['ls', 'foo']' returned non-zero exit status 2.
$ echo $?
0
Environment
linux
Python 3.6.10
0.32.0
I have also check the source code and it seems that while this line sets the result, this other one in clean does not.
I am also wondering if this is designed to be this way, in which case I will try to explain our use case and why we would like to see a negative exit code there π
As usual, thank you! The code is very readable and so far doit
has been very nice to use!
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too