mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Fail gracefully on undecodable install output.
This commit is contained in:
parent
75aaadd4c4
commit
2aaaddb5cc
9 changed files with 104 additions and 24 deletions
6
testing/resources/not_installable_repo/hooks.yaml
Normal file
6
testing/resources/not_installable_repo/hooks.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
- id: foo
|
||||
name: Foo
|
||||
entry: foo
|
||||
language: python
|
||||
language_version: python2.7
|
||||
files: \.py$
|
||||
17
testing/resources/not_installable_repo/setup.py
Normal file
17
testing/resources/not_installable_repo/setup.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
# Intentionally write mixed encoding to the output. This should not crash
|
||||
# pre-commit and should write bytes to the output.
|
||||
sys.stderr.write('☃'.encode('UTF-8') + '²'.encode('latin1') + b'\n')
|
||||
# Return 1 to indicate failures
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
exit(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue