Skip to content

Commit a899ebd

Browse files
authored
Rollup merge of #95722 - xu-cheng:pre-push, r=Mark-Simulacrum
pre-push.sh: Use python3 if python is not found Since Python 2 has reached EOL, `python` may not be available in certain systems (e.g., recent macOS). We should use `python3` in this case to avoid error like `python: No such file or directory`.
2 parents 1d35179 + 365d4f4 commit a899ebd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/etc/pre-push.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Call `tidy --bless` before each commit
3+
# Call `tidy --bless` before git push
44
# Copy this script to .git/hooks to activate,
55
# and remove it from .git/hooks to deactivate.
66
#
@@ -14,6 +14,8 @@ COMMAND="$ROOT_DIR/x.py test tidy --bless"
1414

1515
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
1616
COMMAND="python $COMMAND"
17+
elif ! command -v python &> /dev/null; then
18+
COMMAND="python3 $COMMAND"
1719
fi
1820

1921
echo "Running pre-push script '$COMMAND'"

0 commit comments

Comments
 (0)