Skip to content

Commit

Permalink
Redirect input to terminal only when running through terminal (#8362)
Browse files Browse the repository at this point in the history
Co-authored-by: Timur Karimov <[email protected]>
  • Loading branch information
2 people authored and Jinksi committed Mar 28, 2024
1 parent 940607c commit d91ce5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/bin/bash
. "$(dirname "$0")/_/husky.sh"

# Allows us to read user input below, redirects script's input to the terminal.
exec < /dev/tty
# check if main stream (stdout and stderr) are attached to the terminal
if [ -t 1 ] && [ -t 2 ]; then
# Allows us to read user input below, redirects script's input to the terminal.
exec < /dev/tty
fi

PROTECTED_BRANCH=("develop" "trunk")
CURRENT_BRANCH=$(git branch --show-current)
Expand Down
4 changes: 4 additions & 0 deletions changelog/enhance-pre-push-hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: dev

Ensure pre-push hook understands terminal & non-terminal environments

0 comments on commit d91ce5e

Please sign in to comment.