For example, it’s tricky to validate a commit with pre-commit hook if an app does not return a proper exit code. Here’s a way to validate with the stderr.
- Make a temporary file
- Redirect stderr to the temp file
- Count the length of its content
You can understand it with code snippets below:
$errFile = New-TemporaryFile
errFile = $(mktemp)