Fixes stderr being muted and add a --no-failure

This commit is contained in:
Dandaedre 2024-11-22 23:54:55 -06:00
parent fe849c5f1b
commit 497f7caaaf
3 changed files with 9 additions and 7 deletions

1
.gitignore vendored
View File

@ -18,6 +18,7 @@ release_notes.txt
# IDE files
.idea/
.vscode/
venv
# Ignore external repos used for tests
tests/external_repos/repos

View File

@ -136,8 +136,7 @@ def main():
if not commandLineArguments.stdout:
print(sOutputStd)
if sOutputErr:
if not commandLineArguments.stdout:
print(sOutputErr, file=sys.stderr)
print(sOutputErr, file=sys.stderr)
else:
for iIndex, sFileName in enumerate(commandLineArguments.filename):
@ -147,8 +146,7 @@ def main():
if not commandLineArguments.stdout:
print(sOutputStd)
if sOutputErr:
if not commandLineArguments.stdout:
print(sOutputErr, file=sys.stderr)
print(sOutputErr, file=sys.stderr)
if bKeepProcessingFiles:
break
@ -162,8 +160,7 @@ def main():
if not commandLineArguments.stdout:
print(sOutputStd)
if sOutputErr:
if not commandLineArguments.stdout:
print(sOutputErr, file=sys.stderr)
print(sOutputErr, file=sys.stderr)
if bKeepProcessingFiles:
break
@ -188,7 +185,10 @@ def main():
if commandLineArguments.quality_report:
quality_report.write(commandLineArguments, dJson)
sys.exit(fExitStatus)
if commandLineArguments.no_failure:
sys.exit(0)
else:
sys.exit(fExitStatus)
def create_json_dictionary():

View File

@ -85,6 +85,7 @@ def parse_command_line_arguments():
help="number of parallel jobs to use, default is the number of cpu cores",
)
parser.add_argument("--debug", default=False, action="store_true", help="Displays verbose debug information")
parser.add_argument("--no-failure", default=False, action="store_true", help="Always exits with exit code 0, usefull for scripting")
parser.add_argument("filename_args", metavar="FILENAME", type=__is_valid_file, nargs="*", default=[], help="File to analyze")
args_ = parser.parse_args()