message to stderr if output IOErrors in lint
This is a specific fix for #266 that only covers the lint() output
Written by @fwolfst.
Thanks for the contribution! Could you please provide a test case?
I used a large uncompliant repo and piped to head, but it failed with both your and @fwolfst's solution with the BrokenPipeError.
What was the failure exactly? Worked nicely for me.
I cloned go-gitea/gitea and ran reuse lint | head with your version:
$ reuse --version
reuse 0.13.1.dev20+ga26c2d5
$ reuse lint | head
# MISSING LICENSES
'MIT' found in:
* vendor/github.com/issue9/identicon/block.go
* vendor/github.com/issue9/identicon/doc.go
* vendor/github.com/issue9/identicon/identicon.go
* vendor/github.com/issue9/identicon/polygon.go
# MISSING COPYRIGHT AND LICENSING INFORMATION
Traceback (most recent call last):
File "/home/max/Repositories/fsfe/reuse-tool/venv/bin/reuse", line 33, in <module>
sys.exit(load_entry_point('reuse', 'console_scripts', 'reuse')())
File "/home/max/Repositories/fsfe/reuse-tool/src/reuse/_main.py", line 256, in main
return parsed_args.func(parsed_args, project, out)
File "/home/max/Repositories/fsfe/reuse-tool/src/reuse/lint.py", line 335, in run
result = lint(report, out=out)
File "/home/max/Repositories/fsfe/reuse-tool/src/reuse/lint.py", line 32, in lint
files_without_cali = lint_files_without_copyright_and_licensing(
File "/home/max/Repositories/fsfe/reuse-tool/src/reuse/lint.py", line 220, in lint_files_without_copyright_and_licensing
_write_element(file_, out=out)
File "/home/max/Repositories/fsfe/reuse-tool/src/reuse/lint.py", line 20, in _write_element
out.write(str(element))
BrokenPipeError: [Errno 32] Broken pipe
Can you confirm it?
@aspiers Do you have time to answer Max's question and provide a test?
Not in the next week or two unfortunately, but if no one else can help soon, then I would aim to do it at some point.