mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
show color in hook outputs when attached to a tty
This commit is contained in:
parent
c8620f35e1
commit
7c3404ef1f
27 changed files with 200 additions and 76 deletions
|
|
@ -1,4 +1,8 @@
|
|||
- id: stdout-stderr
|
||||
name: stdout-stderr
|
||||
language: script
|
||||
entry: ./entry
|
||||
entry: ./stdout-stderr-entry
|
||||
- id: tty-check
|
||||
name: tty-check
|
||||
language: script
|
||||
entry: ./tty-check-entry
|
||||
|
|
|
|||
12
testing/resources/stdout_stderr_repo/tty-check-entry
Executable file
12
testing/resources/stdout_stderr_repo/tty-check-entry
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
print('stdin: {}'.format(sys.stdin.isatty()))
|
||||
print('stdout: {}'.format(sys.stdout.isatty()))
|
||||
print('stderr: {}'.format(sys.stderr.isatty()))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
exit(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue